Several vertical panels in an OpenGL window

Is it possible in OpenGL to split a window into several vertical “panels” so that each displays a different set of shapes?

I would like to synchronize the horizontal axes on these panels, but the vertical axes would be completely independent (location as well as scale).

+4
source share
1 answer

The first thing that comes to mind is to apply a few calls to glViewport() . You must display each vertical bar in turn, and then adjust the viewport to the next vertical bar and repeat. I do this to split the screen in half and visualize the scene from two different points of view, but there is no reason why you will have to display the same scene in the second or nth viewport.

So my {edited} code looks something like this:

 glEnable(GL_SCISSOR_TEST); ... // Draw the left scene glViewport(0,0,halfWidth,fullHeight); glScissor(0,0,halfWidth,fullHeight); glClear(...); glPushMatrix(); setLeftEyeModelView(); renderScene(); glPopMatrix(); // Draw the right scene glViewport(halfWidth,0,halfWidth,fullHeight); glScissor(halfWidth,0,halfWidth,fullHeight); glClear(...); glPushMatrix(); setRightEyeModelView(); renderScene(); glPopMatrix(); 
+4
source

All Articles