summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-03-02 03:54:14 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-03-02 03:54:14 +0000
commit81b8aa9ecd7a159a5d90fd0058334a2da4a04f83 (patch)
tree1391019751fa8a9eae7fe6a7068460a40c3e0c29
parent14d3ab96629907622bd25a103b3dadcfccb40b4c (diff)
test glBlitFramebufferEXT w/ -blit flag
-rw-r--r--progs/tests/copypixrate.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/progs/tests/copypixrate.c b/progs/tests/copypixrate.c
index e7620019dc..e9a42a1c8c 100644
--- a/progs/tests/copypixrate.c
+++ b/progs/tests/copypixrate.c
@@ -17,6 +17,9 @@ static GLint ImgWidth, ImgHeight;
static GLenum Buffer = GL_FRONT;
static GLenum AlphaTest = GL_FALSE;
+static GLboolean UseBlit = GL_FALSE;
+
+static PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT_func = NULL;
/**
@@ -98,8 +101,19 @@ RunTest(void)
y = Rand(WinHeight);
if (x > ImgWidth || y > ImgHeight) {
- glWindowPos2iARB(x, y);
- glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR);
+#ifdef GL_EXT_framebuffer_blit
+ if (UseBlit)
+ {
+ glBlitFramebufferEXT_func(0, 0, ImgWidth, ImgHeight,
+ x, y, x + ImgWidth, y + ImgHeight,
+ GL_COLOR_BUFFER_BIT, GL_LINEAR);
+ }
+ else
+#endif
+ {
+ glWindowPos2iARB(x, y);
+ glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR);
+ }
glFinish(); /* XXX OK? */
iters++;
@@ -197,6 +211,22 @@ ParseArgs(int argc, char *argv[])
Buffer = GL_BACK;
else if (strcmp(argv[i], "-alpha") == 0)
AlphaTest = GL_TRUE;
+ else if (strcmp(argv[i], "-blit") == 0)
+ UseBlit = GL_TRUE;
+ }
+}
+
+
+static void
+Init(void)
+{
+ if (glutExtensionSupported("GL_EXT_framebuffer_blit")) {
+ glBlitFramebufferEXT_func = (PFNGLBLITFRAMEBUFFEREXTPROC)
+ glutGetProcAddress("glBlitFramebufferEXT");
+ }
+ else if (UseBlit) {
+ printf("Warning: GL_EXT_framebuffer_blit not supported.\n");
+ UseBlit = GL_FALSE;
}
}
@@ -222,6 +252,7 @@ main(int argc, char *argv[])
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("Draw Buffer: %s\n", (Buffer == GL_BACK) ? "Back" : "Front");
+ Init();
glutMainLoop();
return 0;