diff options
author | Zou Nan hai <nanhai.zou@intel.com> | 2007-07-04 10:52:35 +0800 |
---|---|---|
committer | Zou Nan hai <nanhai.zou@intel.com> | 2007-07-04 10:52:35 +0800 |
commit | fb9ee9b323bff93973a39560b2bc007aace4bddd (patch) | |
tree | 05e1e72e8f4d321cde2c48b8518e6d9736c680dd /progs/tests/drawbuffers.c | |
parent | 285b326c606e9b2f90e4fe177b15b3fa23239b86 (diff) | |
parent | 7ff4359a3be1278b26950f96ab23014a667af838 (diff) |
Merge branch 'master' of git+ssh://znh@git.freedesktop.org/git/mesa/mesa into 965-glsl
Diffstat (limited to 'progs/tests/drawbuffers.c')
-rw-r--r-- | progs/tests/drawbuffers.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/progs/tests/drawbuffers.c b/progs/tests/drawbuffers.c index 8583bac0dd..5e89569380 100644 --- a/progs/tests/drawbuffers.c +++ b/progs/tests/drawbuffers.c @@ -19,6 +19,7 @@ static int Win; static int Width = 400, Height = 400; static GLuint FBobject, RBobjects[3]; static GLfloat Xrot = 0.0, Yrot = 0.0; +static GLuint Program; static void @@ -40,6 +41,8 @@ Display(void) GL_COLOR_ATTACHMENT1_EXT }; + glUseProgram_func(Program); + /* draw to user framebuffer */ glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject); @@ -71,10 +74,12 @@ 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); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); glWindowPos2iARB(0, 0); glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); @@ -243,15 +248,15 @@ SetupShaders(void) " gl_FragData[1] = vec4(1.0) - gl_Color; \n" "}\n"; - GLuint fragShader, program; + GLuint fragShader; fragShader = LoadAndCompileShader(GL_FRAGMENT_SHADER, fragShaderText); - program = glCreateProgram_func(); + Program = glCreateProgram_func(); - glAttachShader_func(program, fragShader); - glLinkProgram_func(program); - CheckLink(program); - glUseProgram_func(program); + glAttachShader_func(Program, fragShader); + glLinkProgram_func(Program); + CheckLink(Program); + glUseProgram_func(Program); } |