Archived

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

Viewport, Ortho result is twice desired size

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

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);
glLoadIdentity();
gluOrtho2D(0, 2, 0, 2);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
	glVertex2i(0, 0);
	glVertex2i(0, 1);
	glVertex2i(1, 1);
	glVertex2i(1, 0);
	glVertex2i(0, 0);
glEnd();

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites