gluPerspective placement
where should the call to gluperspecive go?
I would think that it belongs in the myGlInit() function but that does not produce the behavior I want. It seems to be overridden back to the defaults.
If I place it in the myGlDisplay() function it sets the camera angle and clipping planes just fine.
that seems wrong though. Seems like those attributes should be set once and remain until changed. Right?
gluPerspective changes the active matrix. It should go in whatever function is called when the window is resized, or if you expect to resize the window, the initialization function. Your problem is most likely that you are using the wrong matrix stack, initialization should look something like:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(some stuff);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(some stuff);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement