By definition in OpenGL, the camera is always in (0,0,0).
You then change the modelview matrix to “move the world” around the camera.
So you have to keep track yourself of where in your virtual world your camera is.
What you need is a better way to handle your movement so it isn’t so complicated to keep track of where you are.
In most 3D programming, you make sure to build the modelview matrix from scratch each frame (starting with a call to glLoadIdententiy() ), using the stored position and heading of the camera. A common way is to have 3 vectors, position, up, and direction defining your camera position, and calculate your matrix from that. (basically doing a change of basis in linear algebra)
It gets a slightly trickier to move it around, you have to work with vectors instead of just adds.
But its easier in the long run. It quickly gets confusing if you try to save a matrix between frames, and for not much gain.
Another tip is the gluLookAt function from the gl-utilities.
You can find those here: http://www.khronos.org/developers/resou … tutilities
Can also recommend the PoverVR SDKs matrix classes for all your 3d linear algebra needs.
Find those under the “implementation” tab on the above link.
Note: I say “from scratch” but usually you have parts of it cached of course, but the point is to not let it accumulate over frames, but rebuild it from identity every frame.