Jump to content
  • Advertisement
Sign in to follow this  
Mr Lane

OpenGL Weird aspect ratio issue (all fixed, nothing to see here)

This topic is 4929 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

Hi There has been a fault in my map editor which has been bugging me for some time. Today I decided to track it down, and I found a pattern, but not an explanation for the fault. Basically when I resize the window that my OpenGL viewport is running in, the scene being rendered is sometimes distorted...Now, yes I update the OpenGL viewport using: glViewport(0, 0, width, height); And then I reset the projection matrix: glMatrixMode(GL_PROJECTION); glLoadIdentity(); And then set a new aspect ratio for the perspective projection: gluPerspective(45.0, width/height, 0.1, 100.0); Now what is the problem? Its all fine until the aspect ratio becomes less than 2...as soon as the window is resized to a point of having an aspect ratio less than 2 the cube I have in my window becomes stretched horizontally. When the aspect ratio is less than 1, the cube dissappears all together...I print out the windows sizes in a message box, so I know exactly what point this happens. I cant explain this. No OpenGL app I have written before has this behavior, either Win32, GLUT or SDL. This app is using wxWidgets, but I cant see how that matters... Does anyone know what this is?

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!