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 Main.Graphics; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; /** * * @author DukeA */ public class GameObject { public static void initGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); } public static void RenderGL() { float x = GameWorld.x; float y = GameWorld.y; float rotation = GameWorld.rotation; GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glColor3f(0.5f, 0.5f, 1.0f); GL11.glPushMatrix(); GL11.glTranslatef(x, y, 0); GL11.glRotatef(rotation, 0f, 0f, 1f); GL11.glTranslatef(-x, -y, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x - 50, y - 50); GL11.glVertex2f(x + 50, y - 50); GL11.glVertex2f(x + 50, y + 50); GL11.glVertex2f(x - 50, y + 50); GL11.glEnd(); GL11.glPopMatrix(); } }