OpenGL Rotation

后端 未结 6 1409
-上瘾入骨i
-上瘾入骨i 2021-02-14 11:33

I\'m trying to do a simple rotation in OpenGL but must be missing the point. I\'m not looking for a specific fix so much as a quick explanation or link that explains OpenGL rota

6条回答
  •  一生所求
    2021-02-14 11:43

    Do you get a 1 unit straight line? It seems that 90deg rot. around Y is going to have you looking at the side of a triangle with no depth.

    You should try rotating around the Z axis instead and see if you get something that makes more sense.

    OpenGL has two matrices related to the display of geometry, the ModelView and the Projection. Both are applied to coordinates before the data becomes visible on the screen. First the ModelView matrix is applied, transforming the data from model space into view space. Then the Projection matrix is applied with transforms the data from view space for "projection" on your 2D monitor.

    ModelView is used to position multiple objects to their locations in the "world", Projection is used to position the objects onto the screen.

    Your code seems fine, so I assume from reading the documentation you know what the nature of functions like glPushMatrix() is. If rotating around Z still doesn't make sense, verify that you're editing the ModelView matrix by calling glMatrixMode.

提交回复
热议问题