diff options
author | Brian Paul <brianp@vmware.com> | 2012-11-02 11:49:21 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2012-11-06 16:12:39 -0700 |
commit | 9c5154422664201bdd4b3f329636de5b6d9fd743 (patch) | |
tree | 27a54f5f151655769ca8cd3504ffc4398a1257ba /tests | |
parent | 7b615ff4f3bff4c6dda9f59fb6d8eb69e3c75af9 (diff) |
fbo-gl_pointcoord: remove config.window_width/height and fix asst. bugs
The size of the window and the size of the FBO were mixed up in a few
places. Add missing FBO binding calls so the window can be resized.
Use an rb_size variable instead of hard-coded 100.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fbo/fbo-gl_pointcoord.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/fbo/fbo-gl_pointcoord.c b/tests/fbo/fbo-gl_pointcoord.c index d4771609..f416fe87 100644 --- a/tests/fbo/fbo-gl_pointcoord.c +++ b/tests/fbo/fbo-gl_pointcoord.c @@ -34,8 +34,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_SINGLE; PIGLIT_GL_TEST_CONFIG_END @@ -57,6 +55,8 @@ static GLuint fb, rb; static GLuint testPoint_x, testPoint_y; static GLuint PointSize; +static const int rb_size = 100; + static const float green[] = { 0.0, 1.0, 0.0, 1.0 }; static const float black[] = { 0.0, 0.0, 0.0, 1.0 }; @@ -65,6 +65,10 @@ piglit_display(void) { GLboolean pass = GL_TRUE; + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb); + + glViewport(0, 0, rb_size, rb_size); + glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_POINTS); @@ -73,18 +77,21 @@ piglit_display(void) glBindFramebuffer(GL_READ_FRAMEBUFFER, fb); - testPoint_x = ( piglit_width - PointSize ) / 2; - testPoint_y = ( piglit_width - PointSize ) / 2; + testPoint_x = ( rb_size - PointSize ) / 2; + testPoint_y = ( rb_size - PointSize ) / 2; pass = piglit_probe_pixel_rgb(0, 0, black) && pass; pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_y, green) && pass; - testPoint_y = piglit_height - testPoint_y ; - pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_y - 1, black) && pass; + testPoint_y = rb_size - testPoint_y; + pass = piglit_probe_pixel_rgb(testPoint_x, testPoint_y + 1, black) && pass; /* Draw the point out if want to have a look. */ if (!piglit_automatic){ glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - glBlitFramebuffer(0, 0, 100, 100, 0, 0, 100, 100, GL_COLOR_BUFFER_BIT, GL_NEAREST); + glClear(GL_COLOR_BUFFER_BIT); + glBlitFramebuffer(0, 0, rb_size, rb_size, + 0, 0, rb_size, rb_size, + GL_COLOR_BUFFER_BIT, GL_NEAREST); glFlush(); } @@ -120,7 +127,7 @@ piglit_init(int argc, char **argv) glGenRenderbuffers(1, &rb); glBindRenderbuffer(GL_RENDERBUFFER, rb); - glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, 100, 100); + glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, rb_size, rb_size); glGenFramebuffers(1, &fb); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb); |