Archived

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

Rotate number of objects around a specified point

This topic is 5618 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

hi ppl. 1st of all... im a newbie in openGL, learned around 20-25 nehe lessons and thats it by now, but im looking forward to learn more =P.. i'd like to thanks NeHe , w/o the site i would never get in to openGL.. thanks anyway.. im making a 3d bust-a-move kind game and i need there to rotate my whole table with balls in the game. simply glRotate wont help here because the balls will just stay in their own places (because they rotate around their center) and the table will rotate by his center.. how can i rotate all my objects in this table ? maybe to around all of them around one point in the screen ? i think if i will do that, it will work. so, how do i do that ? thanks in advance. [edited by - sbsergey on July 26, 2002 11:13:03 AM]

Share this post


Link to post
Share on other sites
you still do it with glRotate. but you should use glPushMatrix and glPopMatrix as well..

1. first call glLoadIdentity

2. then make your transformation and rotation for the whole scene using glRotate and glTranslate

3. then call glPushMatrix
use glRotate and glTranslate for your current case
draw whatever you want to draw, say, table
4. call glPopMatrix

repeat the steps 3&4 for all the objects in your scene..

in step 2 you rotate everything. after step 3, you rotate the stuff drawn until step 4..

hope it is clear enough..

Share this post


Link to post
Share on other sites
yeah.. its clear.. i know what push and pop matrix are.. i tried to do this already.. it didnt work as i wanted.. but thanks for your help anyway... maybe i didnt do something right with the push and pop... gonna try with your "step-by-step".. thanks

Share this post


Link to post
Share on other sites