how can I get GL to return the current transformation?

say I translated a whole bunch of times and lost track of all of it, but I needed to know what I was translated to. Is there a function that will tell me what the world is translated to, ex. -10,5,15?

float mat[16]

mat now holds the current modelview matrix and mat[12] mat[13] mat[14] = translational component x,y,z

No that didn’t work at all. All I want to do is save the camera position in 3d space, x y z. Remember, not any rotations, just transformation. The problem is I have no idea of what the position is.

so later I want to be able to reload this transformation. and stick the camera exactly where it was.

someone answer!!!

been working on this problem for 3 months!!

What he said earlier should work except for one thing, you want the projection matrix, not the modelview matrix.

You don’t need to “know” the last location of your camera because I think you can simply select your projection matrix with something like glMatrixMode(GL_PROJECTION) and then “push” the matrix onto the matrix stack. Then “pop” it off the stack later when you want to reload it. I’m pretty new to GL too so someone tell me if I’m totally without a clue here.