View Full Version : Multiple Viewports
07-03-2002, 07:25 AM
Hi, I would like to create a program that uses two viewports. Is there a good tutorial on it? Any tips? Thanks,
07-03-2002, 10:55 AM
Multiple viewports in the same window?
If so, just do this for every viewport:-
1) Call glViewport with its dimensions.
2) Call glScissor with the same list of dimensions. Don't forget to glEnable(GL_SCISSOR_TEST)
3) Set up a projection matrix with the correct aspect ratio of the viewport
4) Draw your stuff.
It really is that simple.
Just look up glViewport and glScissor on http://msdn.microsoft.com/
07-04-2002, 03:50 AM
...and 5) don't forget that OpenGL state is shared between the viewports.
If you intend to clear the entire window (both viewports) with one glClear call, set glViewport to the entire window and glDisable scissor test.
[This message has been edited by marcus256 (edited 07-04-2002).]
If you intend to clear the entire window (both viewports) with one glClear call, set glViewport to the entire window and glDisable scissor test
You don't have to set the viewport to the entire screen before clearing. glClear is only limited by the scissor region, and is not affected by the viewport region. So you can leave the viewport as it is and only disable the scissor test. Saves a gl-call and a state change http://www.opengl.org/discussion_boards/ubb/smile.gif
For a tutorial/demo on multiple OpenGL viewports see,
"Multiple Views" and "Antimating Multiple Views" at www.mfcogl.com. (http://www.mfcogl.com.)
They are in MFC, but the OpenGL stuff is valid for any OS and/or compiler.
07-05-2002, 01:47 PM
I believe he's talking about multiple viewports in the same window - multiple views in MFC simply means multiple windows, which isn't the same thing.
The tutorial/demos are on multiple OpenGL viewports in the same window not multiple views in MFC.
07-06-2002, 05:38 AM
Apologies for my incorrect assumption.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.