diff options
Diffstat (limited to 'progs/tests')
-rw-r--r-- | progs/tests/fbotest2.c | 46 | ||||
-rw-r--r-- | progs/tests/vao-01.c | 2 | ||||
-rw-r--r-- | progs/tests/vao-02.c | 2 |
3 files changed, 39 insertions, 11 deletions
diff --git a/progs/tests/fbotest2.c b/progs/tests/fbotest2.c index 872b46279e6..faf0dd87484 100644 --- a/progs/tests/fbotest2.c +++ b/progs/tests/fbotest2.c @@ -33,7 +33,8 @@ CheckError(int line) static void Display( void ) { - GLubyte *buffer = malloc(Width * Height * 4); + GLboolean copyPix = GL_FALSE; + GLboolean blitPix = GL_FALSE; GLenum status; CheckError(__LINE__); @@ -63,16 +64,43 @@ Display( void ) glutSolidTeapot(2.0); glPopMatrix(); - /* read from user framebuffer */ - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + if (copyPix) { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + glDrawBuffer(GL_BACK); - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + + glWindowPos2iARB(0, 0); + glCopyPixels(0, 0, Width, Height, GL_COLOR); + } + else if (blitPix) { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + glDrawBuffer(GL_BACK); + + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + + glBlitFramebufferEXT(0, 0, Width, Height, + 0, 0, Width, Height, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + } + else { + GLubyte *buffer = malloc(Width * Height * 4); + /* read from user framebuffer */ + glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + /* draw to window */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glDisable(GL_DEPTH_TEST); /* in case window has depth buffer */ + glWindowPos2iARB(0, 0); + glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + free(buffer); + } - free(buffer); glutSwapBuffers(); CheckError(__LINE__); } diff --git a/progs/tests/vao-01.c b/progs/tests/vao-01.c index e4a89cb19db..ee528d22439 100644 --- a/progs/tests/vao-01.c +++ b/progs/tests/vao-01.c @@ -30,7 +30,7 @@ * it (via \c glPopClientAttrib). After popping, the state of the VAO is * examined. * - * According the the APPLE_vertex_array_object spec, the contents of the VAO + * According to the APPLE_vertex_array_object spec, the contents of the VAO * should be restored to the values that they had when pushed. * * \author Ian Romanick <[email protected]> diff --git a/progs/tests/vao-02.c b/progs/tests/vao-02.c index 9f7f5c27792..c23b4ab05a6 100644 --- a/progs/tests/vao-02.c +++ b/progs/tests/vao-02.c @@ -30,7 +30,7 @@ * it (via \c glPopClientAttrib). After popping, the state of the VAO is * examined. * - * According the the APPLE_vertex_array_object spec, the contents of the VAO + * According to the APPLE_vertex_array_object spec, the contents of the VAO * should be restored to the values that they had when pushed. * * \author Ian Romanick <[email protected]> |