Jump to content
  • Advertisement
Sign in to follow this  
waxor

gluPerspective placement

This topic is 5458 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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();

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!