PDA

View Full Version : Multiple Viewports



06-09-2003, 05:57 PM
How should I go about creating and managing multiple viewports in one window? I would like to create two viewports each with a seperate scene and also a third that acts as a border around the other two. The third viewport will only contain an image, and does not change (maybe there is a function to simply draw a pixmap of some kind over the entire screen except for the two areas of the screen with my two viewports?). All this should be within one window (I am using MS Windows). Or maybe I could do this with multiple windows instead? Thanks for the help,

-GeoHoffman49431@aol.com
(if replying to this address please put opengl in the subject as I go through much junk mail and might delete your reply by mistake).

mikael_aronsson
06-09-2003, 07:38 PM
Hi !

You use glViewport() to set the area you would like to render into in the window, so you can use glViewport() to set one area to render viewport one, then you can call glViewport() to change the area to draw into when you need to render the second viewport and so on.

I would suggest that you do use glViewport and one singel window instead of multiple windows, on some hardware a context switch can be pretty expensive.

glScissor() can be used to define an area in the viewport to limit all output to.

You can also use the glStencilFunc() glStencilOp() and friends to define an area of any shape to limit all output to.

I hope that would get you started at least.

Mikael

06-10-2003, 05:00 AM
I saw a nice tutorial about multiple windows on: http://nehe.gamedev.net. It's the last one of the lessons.(lesson 42 I believe)