Extracting camera/viewer position?

Hi,

i’d like to extract the camera position from OpenGL. But my solution doesn’t work somehow. If i just rotate the camera the translation values significantly change (and they really shouldn’t )

float mv[16];
float tx,ty,tz;
glGetFloatv(GL_MODELVIEW_MATRIX,mv);
tx = mv[12];
ty = mv[13];
tz = mv[14];

What’s wrong with my code/“solution”?

Thank you very much.

cheers,
Stephan