Hello!

I'm writing an engine that uses opengl, and I'm want to implement an FPS style camera. I'm handling my own matrices. So each object has its own matrix. The matrix were implemented in a row-major order and using post-multiplication (I know, exactly the inverse of the opengl, but i need it somehow independent of the opengl "style" ).

My render function is like this:

void render() { glMatrixMode(GL_MODELVIEW); glViewport(0,0,width,height); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glColor3f( 1.f, 1.f, 0.f ); for(unsigned int i = 0; i < scene->primitives.size(); i++) { Primitive* object = scene->primitives[i]; glPushMatrix(); vector3f pos = object->globalOrigin; glTranslatef(pos.coord[0],pos.coord[1],pos.coord[2]); glutSolidSphere(1, 20, 20); glPopMatrix(); } Matrix4x4 modelview = scene->camera.getGLTransform(); glMultMatrixf((GLfloat*)modelview.data); glFlush(); }

It basically draw a bunch of spheres. The function getGLTransform() just get the matrix from camera and transposes it.

From what i understand, for a fps style camera, i need first translate my world space in relation to the camera position, and then rotate it. So, i must apply the camera transformation last in my code, because opengl uses pre-multiplication and the transformations are applied from last to first. But the above code dont respond to my camera location and rotations.

If i apply the transformations from camera right after glLoadIdentity(), it respond to camera position and rotation, but it dont rotate like a fps system. It first rotate my world space, and then translate.

I already checked the matrices and they are okay.

I just cant see what I'm doing wrong, please help me.

Thanks in advance.