# 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.

## 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 on other sites
Yes. The coordinates you send get multiplied by the modelview matrix
and the projection matrix.
Posting some code would help...

##### 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 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 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.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628697
• Total Posts
2984271

• 19
• 9
• 13
• 13
• 11