PDA

View Full Version : Moving and rotating a "camera"



skippyj777
08-17-2000, 02:03 PM
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?

El Jefe
08-19-2000, 06:43 PM
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.

skippyj777
08-21-2000, 12:25 PM
Using gluLookAt gives the exact same results that I got when I was using glRotate and then glTranslate. What am I possibly doing wrong?

MikeC
08-21-2000, 03:36 PM
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.

skippyj777
08-22-2000, 03:45 PM
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.

skippyj777
08-23-2000, 09:36 AM
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.