If I have defined the position and orientation of a “camera” in world coordinates using a position vertex, a normalized look-at vector, and a normalized look-up vector, how can I modify the current matrix using glRotate or glTranslate or something else to adjust the view properly?
If you intend to use a forward and up vector…plus an origin, why not just use gluLookAt?
Personally, I have found it much, much easier to actually store my current view angles and origin…this is what Quake does too. Where my solution differs from Quake though…I just use a simple set of glRotates…and a glTranslate to orient the camera. I think Quake builds a camera matrix directly.
Using gluLookAt gives the exact same results that I got when I was using glRotate and then glTranslate. What am I possibly doing wrong?
Originally posted by El Jefe:
…I just use a simple set of glRotates…and a glTranslate to orient the camera. I think Quake builds a camera matrix directly.
You need the camera matrix for several interesting things (view frustum culling, screen-aligned particles, some sorts of HUD overlay etc). You can’t glGet it without stalling the pipeline.
I’m still stuck. The only conclusion I can come to is that wglMakeCurrent messes with the projection matrix. I’m goig to try moving all calls to wglMakeCurrent after my viewport setup, but I still would appreciate some ideas if anyone knows of alternatives.
Problem solved. wglMakeCurrent does mess up the projection matrix. See http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/001201.html for more info if you have a similar problem.