PDA

View Full Version : Multiple Viewports



ToddAtWSU
08-28-2006, 03:56 PM
I am trying to make a 2-D graph renderer and want to use multiple viewports, 1 for the graph and 2 others for the x-axis and y-axis tickmarks and values. My question is, can I have different clear colors for each of the viewports? I want the background of the 2 axes to be a different color from the background of the main plot. But whenever I call glClearColor or something after declaring my viewport, I get the same background color for all of my viewports. Any ideas why I cannot just clear the color on my viewport. I would prefer not place a rectangle over the viewport to clear it if that is possible. Thanks for your help!

Bob
08-28-2006, 04:23 PM
Use glScissor to specify what area to clear. You should, in many situations, always follow a viewport call by a corresponding scissor call. The viewport doesn't clip anything, but the scissor box does, so the viewport alone is not enough to restrict drawing to a rectangle on the screen.

ToddAtWSU
08-29-2006, 06:30 AM
I enabled scissoring and then defined my viewport and scissor plane and then called the clearColor function which in turn colored the whole screen to the color I wanted just for my viewport. I will mess around with it again, but I tried exactly what you said to try. Thanks again!

08-29-2006, 09:47 AM
Can we see what you tried, ToddAtWSU?