Archived

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

paytuition2004

camera and picking

Recommended Posts

Hi I''m having trouble using gluLookAt. I''m trying to rotate my scene at an axis with respect to the camera(i want to spin the scene around but i don''t want the camera position to move). i always end up spinning around the scene in a weird way instead. don''t know if that made sense. im doing this: gluLookAt(eye1, eye2, eye3, object1, object2, object3, 0, 1, 0); object coordinates are constant and i increment the eye coordinates. must be doing something wrong... another question, in my little scene, i have a tank that shoots out projectiles. I want to be able to ''pick'' the tank and drag it to wherever i want. How do I accomplish this? Im a little confused since it''s in 3d. someone told me to use the selection buffer and glupickmatrix, while another told me to use unproject... what''s the best way to do it? thanks in advance

Share this post


Link to post
Share on other sites
Hi, I think I can answer your question concerning gluLookAt.

gluLookAt(eye1, eye2, eye3, object1, object2, object3, 0, 1, 0);

so if you call gluLookAt in this way and you want to rotate entire scene about an specified axis you need to call

gluLookAt()

before

glRotatef( angle,1.0,1.0,1.0); // rotates about vector [1,1,1]

// you can increment variable angle which in this case is of type float.

draw_the_scene();

because when you call glRotatef() before gluLookAt() you affect MODELVIEW matrix and that''s why view point in your program behaves strange.

Best regards
rafalp

Share this post


Link to post
Share on other sites