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();
Viewport, Ortho result is twice desired size
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement