Having problems to understand OpenGL view method... [solved]

Hello!

I’m trying to make a 3D game with LWJGL and right now I got the movement basics in 2D (moving a cube upwards when pressing “W” and such…) but now I want to move the camera so I get a nice 3D view. I’m trying to do it with gluLookAt() but it just don’t have any result at all… I’ve drew the cube at 0,0,0 and I wanted to go a bit far so I can see it completely but gluLookAt does nothing. I don’t actually know exactly after what MatrixMode I have to write it, MODELVIEW or PROJECTION? >.<

I’m using this:

GLU.gluLookAt(0.0f, 0.0f, -5.0f,
          	    0.0f, 0.0f, 0.0f,
          	    0.0f, 1.0f, 0.0f);

I’ve tried using it after

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);

and after

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

but no one works. I’ve actually tried using gluPerspective but I need to change the view’s angle so…

I’ve also tried to use glRotatef(30.0f, 1.0f, 0.0f, 0.0f) and glTranslatef(0.0f, 0.0f, 5.0f) but had 0 effect xD

I need a bit of help here! Help please :slight_smile:

edit: So i searched thru google (i did that before "-.-) and finally find a piece of code that worked well for me:

glMatrixMode(GL_MODELVIEW);
	    glLoadIdentity();
	    GLU.gluLookAt(0, 1, 5, 
	                  0, 0, 0, 
	                  0, 1, 0);

	    glPushMatrix();
	    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); 

And after that put all the cube’s code.