Jump to content
  • Advertisement


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.

If you intended to correct an error in the post then please contact us.

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 this post

Link to post
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]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!