Why is there a glMatrixMode in OpenGL?

后端 未结 4 494
攒了一身酷
攒了一身酷 2021-02-05 13:10

I just don\'t understand what OpenGL\'s glMatrixMode is for.

As far as I can see, when glMatrixMode(GL_MODELVIEW) is called, it is followed by

4条回答
  •  执笔经年
    2021-02-05 13:30

    You can use glRotate and glTranslate for projection matrices as well.

    Also: OpenGL supports transforms of textures and colors. If you active this feature you can for example modify the texture coordinates of an object without rewriting the texture coordinates each frame (slow).

    This is a very useful feature if you want to scroll a texture across an object. All you have to do for this is to draw the textured object, set the matrix mode to GL_TEXTURE and call glTranslate to set the offset into the texture.

提交回复
热议问题