Rotate number of objects around a specified point

Started by
1 comment, last by sbsergey 21 years, 8 months ago
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]
Advertisement
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..

-----------my quote is under construction
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

This topic is closed to new replies.

Advertisement