gluPerspective, glViewport, gluLookAt and the GL_PROJECTION and GL_MODELVIEW Matricies

前端 未结 1 720
小鲜肉
小鲜肉 2020-12-14 13:18

Original Question

I want to use \'gluPerspective\', \'glViewport\' and \'gluLookAt\' to manipulate my camera and screen.

Which functions to I apply to which

相关标签:
1条回答
  • 2020-12-14 13:35

    I define my reshape callback function as:

    Call glViewport(...) once in the beginning.

    Then reload the projection matrix with an identity matrix:

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    

    Then:

    glPerspective(...)
    glMatrixMode(GL_MODELVIEW);
    

    gluLookAt(...) can be called anytime later if you need to change your camera position.

    Works for my simple purposes.

    0 讨论(0)
提交回复
热议问题