Rotating an object around a fixed point in opengl

后端 未结 4 362
我在风中等你
我在风中等你 2020-12-16 01:19

I have a problem with this openGL code:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix(); // put current matrix on stack

//glTranslatef(0.0f, 0.         


        
4条回答
  •  感动是毒
    2020-12-16 01:58

    Simply do the rotation after the translation. The order matters.

    glTranslatef(xpos, ypos, zpos);
    glRotatef(rotationAngle, 0.0f, 1.0f, 0.0f);
    

提交回复
热议问题