Archived

This topic is now archived and is closed to further replies.

Viewport rotations:

This topic is 6276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here''s my problem: I''m using gluLookAt to focus on a particular point on my scene, while maintaining a set distance. I''ve added rotation about the x and y axis by using glRotatef after the intial call to gluLookAt. This works fine at the origon, however I move the point of focus around which causes everything to get misaligned. Please note that I''m trying to avoid doing a manual rotation of the camera vector, which would probably fix the problem. My question is, as always, is there another way? ----------------------------- Mice are an excellent source of mice.

Share this post


Link to post
Share on other sites
I made this post late at night and I didn''t manage to get any responses before it got pushed down to the bottom of the list.

If anybody has any ideas it would be apreciated.

-----------------------------
Mice are an excellent source of mice.

Share this post


Link to post
Share on other sites
Well I got back from work and about an hour later I got the problem fixed. For reference here's the solution I used:

glTranslatef( 0.0f, 0.0f, -distance );
glRotatef( -camAnglex, 1.0f, 0.0f, 0.0f );
glRotatef( -camAngley, 0.0f, 1.0f, 0.0f );
glTranslatef( -playerx, -playery, -playerz );

// Draw Scene

glTranslatef( playerx, playery, playerz );

// Draw Player

Notice there's no anoying vector math or any need to deal with the up vector. Since I had no need for roll gimble lock shouldn't be an issue (only two axis of rotation).

Edited by - Jo on October 5, 2000 9:47:46 PM

Share this post


Link to post
Share on other sites