gluPerspective placement

Started by
1 comment, last by waxor 19 years, 6 months ago
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?
Advertisement
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();
Thanks, that was sorta the problem, I was working with the correct matrix but I had someone else's Resize() funciton that I grabbed from a really old project. That was what was messing it up.

It was using glOrtho to reshape the window.

thanks for the pointer.

This topic is closed to new replies.

Advertisement