Advertisement

Rotation Problem

Started by October 30, 2003 11:09 AM
2 comments, last by JonasV 21 years, 4 months ago
Hi out there, I guess this is a kind of special problem, thats why didn''t found something while seraching. It is less a technical probleme that a, well, technique(?) problem . I got several rings: Every next ring is a bit larger. Every ring is spinning around the Z-Axis, but ....aaaah, picture: <- / -> spinning direction ---------- ring 1 -> ---------- ---------- <- ring 2 ---------- ---------- ring -> 3 ---------- center <- ring 3 and ring 2 -> so <- ring 1 on.... It is a kind of plane wheel - seen from the top. I am spinning/rotating the rings via glRotatef like this: glRotatef(WorldRotation,0.0f,0.0f,1.0f); // for Rings spinning to left and glRotatef(WorldRotation,0.0f,0.0f,-1.0f); // for Rings spinning to right The rings should be on one level, but when I want to spin the figure around the Y axis (while the rings itself are spinning), the rings don''t stay on one level, when I use it like this: glRotatef(WorldRotation,0.0f,1.0f,1.0f); glRotatef(WorldRotation,0.0f,1.0f,-1.0f); Can anyone help me? I hope it became clear what I wanted to say. (My English isn''t that good...)
glPushMatrix();

do rotation
draw ring

glPopMatrix();

glPushMatrix();

do next rotation
draw ring

glPopMatrix();


Learn the effects of pushing and poping, they will be your best friend
Advertisement
The x,y and z parameters to glRotate is setting the vector to rotate around. See http://gamedev.net/community/forums/post.asp?method=reply&topic_id=188492

Try two calls to glRotate for each ring.
The link above should be
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_21d1.asp

This topic is closed to new replies.

Advertisement