PDA

View Full Version : multiple viewports



jra3084
04-29-2003, 03:41 AM
I'm trying to divide a window into for viewports but am unsure how. It looks good until something happens that causes a reshape. Each viewport image then takes on the colors of the last one. any suggestions?

Relic
04-29-2003, 05:10 AM
glClear is not affected by glViewport (the viewport is just a matrix scale).
Enable GL_SCISSOR_TEST and use glScissor to restrict drawing to the individual viewports.

jra3084
04-29-2003, 06:34 AM
Originally posted by Relic:
glClear is not affected by glViewport (the viewport is just a matrix scale).
Enable GL_SCISSOR_TEST and use glScissor to restrict drawing to the individual viewports.

This doesnt work. It makes it so I can only draw one thing. I need to be able to reshape correctly. the shapes are fine, but the colors are messed up. any other sugg.?

Relic
04-29-2003, 07:52 AM
Not without the basic code steps you use to initialize and render the different viewports and the part which goes wrong.
I assumed your last viewport's background color bleeded onto the other viewports.
What do you mean you can only draw one thing?
Don't you do something like this?

glEnable(GL_SCISSOR_TEST);
for each view
{
glViewport;
glScissor;
glClear; // Here or only once outside the loop before the enable scissor if the clear color is the same for all views.
setup matrices;
draw complete scene;
}