#### Archived

This topic is now archived and is closed to further replies.

# Viewport, Ortho result is twice desired size

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

## Recommended Posts

Dear all, I am a little puzzled by viewports and the Ortho projection matrix at the moment. Using the following code, I am defining viewport that is the top right quater of a window, and as an experiment defining the viewport to have 2 units for X & Y What puzzles me is that when I draw the square (in the code) it is the entire viewport size, not 1 quater of the viewport size!! Have I missed something here??? Thanks guys Paul.
glViewport(m_uWidth / 2, m_uHeight / 2, m_uWidth, m_uHeight);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 2, 0, 2);
glMatrixMode(GL_MODELVIEW);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex2i(0, 0);
glVertex2i(0, 1);
glVertex2i(1, 1);
glVertex2i(1, 0);
glVertex2i(0, 0);
glEnd();


##### Share on other sites
quote:
Original post by pprice001
... I am defining viewport that is the top right quater of a window...

Hint: Check some documentation on what the two last parameters of glViewport means.

##### Share on other sites
What a minute, I think I might have another stupid question!!

Thanks, I obviously suffer from some kind of lazy reading problem, first word and last word of every sentence or something!

But now I understand, appreciated!

Paul.