#### Archived

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

# help with rotation

This topic is 5358 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

int DrawGLScene(GLvoid) // Here''s Where We Do All The Drawing { bool status=true; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); // Reset glTranslatef(x,y,z); // glRotatef(rotx,1.0f,0.0f,0.0f); glRotatef(roty,0.0f,1.0f,0.0f); glRotatef(rotz,0.0f,0.0f,1.0f); glColor3f(1,1,1); glBegin(GL_QUADS); glVertex3f(-1,-1,0.0f); glVertex3f(1,-1,1.0f); glVertex3f(1,1,0.0f); glVertex3f(-1,1.0f,0.0f); glEnd; glBind(GL_TEXTURE_2D,texture[0]); DrawSprite(-3,-3,3,3,8,8,fr); glBind(GL_TEXTURE_2D,texture[0]); DrawSprite(-1,-1,1,1,16,16,fr); rotz+=1.0f; -Doesnt seem to work fr++; if (fr == 18) fr = 0; return status; } can someone please tell me y the rotation doesnt work it doesnt rotate on the z and the only other place i used rotz is in initialization where it is a GLfloat;

##### Share on other sites
The problem is called gimbal lock

do some google search to find out what exactly that means.

one solution to the problem is to use quaternions, which are a pain in the but to understand and get to work.

[edited by - Quadratic on February 21, 2004 3:00:15 PM]

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009811
• ### Who's Online (See full list)

There are no registered users currently online

×