Advertisement

How to use the glulookat()?

Started by August 28, 2003 05:09 AM
1 comment, last by zhang_he 21 years, 6 months ago
I try add a glulookat() in the ReSizeGLScene() in the lesson 5 of the NEHE tutorial, but it seems no effect the code: GLvoid ReSizeGLScene(GLsizei width, GLsizei height) { if (height==0) { height=1; } glViewport(0,0,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt (10.0, 10.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //************** add ************** } looking forward to your reply
I believe the modelview matrix is reset in the draw function as well. You should put the gluLookAt(...) after the glLoadIdentity() call there instead. See if that works better.

---
K-1 Productions: Come visit us here.
---K-1 Productions: Come visit us here.
Advertisement
very nice!
I have solved this problem, you are right, the glLoadIdentity() in the drawscene() cause to reset the GL_MODELVIEW Matrix.
I really appreciate your help.

This topic is closed to new replies.

Advertisement