How do I rotate or translate individual object instances in OPENGL?

后端 未结 1 584
眼角桃花
眼角桃花 2021-01-07 09:33

Lets say i have a scene with four cubes. How do I say rotate/translate only two of these cubes in OpenGL without changing the others using glrotatef anf gltranslate? I dont

相关标签:
1条回答
  • 2021-01-07 10:19
    1. You draw your first two cubes as usual
    2. Push the view-model matrix (glPushMatrix(GL_MODELVIEW_MATRIX))
    3. Call glRotate/glTranslate to setup the rotation of the two cubes which you want to draw in a different way
    4. Draw the other two cubes
    5. Pop the original view-model matrix (glPopMatrix(GL_MODELVIEW_MATRIX))
    0 讨论(0)
提交回复
热议问题