Rotate number of objects around a specified point
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]
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..
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..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement