You were right, fool running, that I am using glOrtho, am I not supposed to be using glOrtho? I always thought that was the 'thing' to use for 2D and 3D implementations. Am I supposed to be doing something different for 3D implementations?
By the way, here is all of my code relating to the rendering:
This is the setup piece that pretty much sets everything up such as the projection matrix:
public void init()
{
try {
Mouse.setGrabbed(true);
Display.setTitle(TITLE);
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, width, height, 0, -1000, 1000);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
} catch (LWJGLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
initEnt();
}
This is the piece that handles rendering of cubes, I have a few extra bits and bobs commented out for if I ever wanted to add textures to the cube:
public void draw(float x, float y, float z, float rot)
{
//GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_NEAREST);
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
GL11.glBegin(GL11.GL_QUADS);
{
//Six Sides Needed
//Back
GL11.glColor3f(1, 0, 0);
GL11.glVertex3f(0, 0, 50);
GL11.glVertex3f(0, 50, 50);
GL11.glVertex3f(50, 50, 50);
GL11.glVertex3f(50, 0, 50);
//Front
GL11.glColor3f(1, 1, 0);
GL11.glVertex3f(0, 0, 0);
GL11.glVertex3f(0, 50, 0);
GL11.glVertex3f(50, 50, 0);
GL11.glVertex3f(50, 0, 0);
//Bottom
GL11.glColor3f(0.5f, 0.5f, 1);
GL11.glVertex3f(0, 0, 0);
GL11.glVertex3f(50, 0, 0);
GL11.glVertex3f(50, 0, 50);
GL11.glVertex3f(0, 0, 50);
//Top
GL11.glColor3f(1, 0.5f, 0.5f);
GL11.glVertex3f(0, 50, 0);
GL11.glVertex3f(50, 50, 0);
GL11.glVertex3f(50, 50, 50);
GL11.glVertex3f(0, 50, 50);
//Side
GL11.glColor3f(1, 1, 1);
GL11.glVertex3f(0, 0, 0);
GL11.glVertex3f(0, 50, 0);
GL11.glVertex3f(0, 50, 50);
GL11.glVertex3f(0, 0, 50);
//Side
GL11.glColor3f(0.5f, 0.5f, 0.5f);
GL11.glVertex3f(50, 0, 0);
GL11.glVertex3f(50, 50, 0);
GL11.glVertex3f(50, 50, 50);
GL11.glVertex3f(50, 0, 50);
}
GL11.glEnd();
GL11.glPopMatrix();
}
And this is what runs in my loop and controls the gluLookAt
while(!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE))
{
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GLU.gluLookAt(0, 400, 0, 500, 400, 0, 0, 1, 0);
/*
GL11.glTranslatef(45, 360, 0);
GL11.glRotated(45, 0, 1, 0);
GL11.glRotated(roty, 1, 0, 0);
*/
frameLoop();
Display.update();
}
Display.destroy();
System.exit(-1);
I have absolutely no idea what is wrong, any help is appriciated.