summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-08-13 08:46:35 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-08-13 08:46:50 -0600
commit60b92129b1334bd8a1dea3dcf153871f0e73f756 (patch)
tree142fb86fc34c4185822e77438a2970b7d6cf0747
parentf911ca0834934fe678383b9edcffc79639dd77eb (diff)
mesa: clear the unused upper-left region to black instead of leaving it undefined
-rw-r--r--progs/demos/gearbox.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/progs/demos/gearbox.c b/progs/demos/gearbox.c
index 3a1662cd62..35bde04417 100644
--- a/progs/demos/gearbox.c
+++ b/progs/demos/gearbox.c
@@ -264,38 +264,44 @@ draw(void)
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
+ /* clear whole depth buffer */
glDisable(GL_SCISSOR_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
- /* draw gears */
+ /* clear upper-left corner of color buffer (unused space) */
+ glScissor(0, TexHeight, TexWidth, WinHeight - TexHeight);
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* clear lower-left corner of color buffer */
glViewport(0, 0, TexWidth, TexHeight);
glScissor(0, 0, TexWidth, TexHeight);
- glClearColor(0.5, 0.5, 0.8, 0.0);
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
+ /* draw gears in lower-left corner */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
-
DrawGears();
+ /* copy color buffer to texture */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
- /* draw textured cube */
+ /* clear right half of color buffer */
glViewport(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glScissor(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
+ /* draw textured cube in right half of window */
ar = (float) (WinWidth - TexWidth) / WinHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
-
DrawCube();
/* finish up */