Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model; import javax.vecmath.Vector2d; import javax.vecmath.Vector2f; import org.lwjgl.opengl.GL11; /** * * @author mati */ public class Quad implements Renderable { Vector2f center; public Quad() { center = new Vector2f(0, 0); } public Quad(float x, float y) { center = new Vector2f(x, y); } @Override public void render() { GL11.glBegin(GL11.GL_QUADS); GL11.glColor3f(0.5f, 0.5f, 1.0f); GL11.glVertex2f(center.x - 50, center.y - 50); GL11.glVertex2f(center.x - 50, center.y + 50); GL11.glVertex2f(center.x + 50, center.y + 50); GL11.glVertex2f(center.x + 50, center.y - 50); GL11.glEnd(); } }