PDA

View Full Version : glViewPort doent work twice



04-02-2002, 02:18 AM
I want to draw a scene from 2 different points on view.

But when I do :

glViewPort(0,0,w/2,h);
display();
glViewPort(w/2,0,w/2,h);
display();
glutSwapBuffer();

it only draws in the SECOND ViewPort : (w/2,0,w/2,h)
And when I write
glViewPort(0,0,w/2,h/2);
display();
glViewPort(0,h/2,w/2,h/2);
display();
glviewport(w/2,0,w/2,h/2);
display();
glViewPort(w/2,h/2,w/2,h/2);
display();
glutSwapBuffers();

It also draws only un the LAST ViewPort : (w/2,h/2,w/2,h/2).

Can you help me? Thank you very much. http://www.opengl.org/discussion_boards/ubb/smile.gif

Bob
04-02-2002, 03:01 AM
You probably call glClear in your display function. glClear will clear the entire client area, and not only the part specified by glViewport. What happens when you draw your second viewport is that you clear the entire client area, and the first viewport is erased (same for third and fourth viewport, any previsously drawing will be cleared). If you want to limit the area of glClear, you must use glScissor also.

04-03-2002, 01:10 AM
Thank you!!! That was the solution!!! Great!

http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif http://www.opengl.org/discussion_boards/ubb/smile.gif