Sign in to follow this  

Very irrating and simple OpenGL problem (GL_QUADS)

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

Okay I have a very simple OpenGL problem but it is very annoying. I have drawn what I assume to be a square (all the co-ordinates make it a square if you plot it on a graph) yet OpenGL seems to render it as a rectangle. At first I thought it was because I was using a widescreen resolution so I changed it to a standard aspect ratio but it still renders as a square. I'm using gluOrtho2D if that makes any difference. Do I need to account for anything in my co-ordinates at all? Because this is a really irrating problem. Even the NeHe tutorial (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=02) says that the co-ordinates make a square yet when I render I get a rectangle. What is going on?

Share this post


Link to post
Share on other sites
Does the view volume specified by invoking gluOrtho2D match the proportions of the window/screen you render into? Is the glViewport properly set-up?

EDIT: E.g. the view volume can be computed as

horiz = 0.5f * columns / ( resolution * scale );
vert = 0.5f * rows / ( resolution * scale );
gluOrtho2D( -horiz, +horiz, -vert, +vert );
where (columns, rows) denotes the size of the window/screen in pixels, resolution denotes the video resolution, and scale denotes just a scale factor (e.g. 1/10 if you want to have the image a tenth of the real world size). However, the important part is that horiz is proportional to columns, and vert is proportional to rows.

Share this post


Link to post
Share on other sites
As is always the case with things like this it appears that I have messed up on the viewport. Thanks for the quick responses. I'm going to re-read some of the red book I think as I have obviously missed out on some important stuff :(.

Share this post


Link to post
Share on other sites

This topic is 3662 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this