fix glReadPixels parameters to handle odd-width windows correctly
authorBrian <brian.paul@tungstengraphics.com>
Fri, 8 Jun 2007 19:10:01 +0000 (13:10 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Fri, 8 Jun 2007 19:10:01 +0000 (13:10 -0600)
progs/tests/drawbuffers.c

index d2e826fadfe2e8afa085d52be3d5b9c9d8a48094..5e89569380a48da3730b20808845698157ae2004 100644 (file)
@@ -74,8 +74,9 @@ Display(void)
                 buffer);
    /* top half = colorbuffer 1 */
    glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
-   glReadPixels(0, Height/2, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE,
-                buffer + Width * Height / 2 * 4);
+   glReadPixels(0, Height/2, Width, Height - Height / 2,
+                GL_RGBA, GL_UNSIGNED_BYTE,
+                buffer + Width * (Height / 2) * 4);
 
    /* draw to window */
    glUseProgram_func(0);