viewport background color

Started by
2 comments, last by Brother Bob 18 years, 9 months ago
I want to clear multiple viewports each with its own color. What is the best way to do it?
Advertisement
glClearColor (r1, g1, b1, a1);
...
glViewport (x1, y1, w1, h1);
...
glClearColor (r2, g2, b2, a2);
...
glViewport (x2, y2, w2, h2);
glClear doesn't seem to be restricted by the current viewport, it clears the entire screen.
glScissor will restrict the area cleared. Since the viewport does not prevent fragments from being generated outside the viewport, I advice you to keep the viewport and the scissor box in sync, unless you have a good reason not to, of course. That way, you will never touch anything outside the viewport, and that includes glClear.

This topic is closed to new replies.

Advertisement