Regarding my post here
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=277315#Post277315
I have written small test program to demonstrate my MRT error in ATI catalyst 10.4
The program are written in c++ and required GLFW and GLEW which already include/link in to source
folder.
The code are program using OpenGL 3.2 forward compatibility profile and contain no deprecate function.
The program contain some simple wraping class.
FBO ---> encapsulate basic FBO function and initialization function
Shader ----> encapsulate basic shader loading,activate,deactivate function
TestMRTShader -----> derived from class "Shader" and implement some basic MRT (detail below)
TestModule -----> contain OpenGL initialization and rendering loop
the class TestMRTShader implement some basic MRT function.
the source code of shader are store in folder “./source/STEngineNew/shader/test MRT”
It bind output location in following manner (see TestMRTShader::bindOutputLocation)
glBindFragDataLocation(this->program,0,"redChannel");
glBindFragDataLocation(this->program,1,"greenChannel");
glBindFragDataLocation(this->program,2,"blueChannel");
glBindFragDataLocation(this->program,3,"yellowChannel");
in TestModule::render has the following code
void TestModule::render(){
//activate FBO
this->fbo.activateFBO();
//select target color buffer
GLenum targetBuffer[] = {GL_COLOR_ATTACHMENT0,GL_COLOR_ATTACHMENT0+1,GL_COLOR_ATTACHMENT0+2,GL_COLOR_ATTACHMENT0+3};
this->fbo.selectMultipleDrawBufferByID(targetBuffer,4);
//clear color
glClearColor(0.0f,0.0f,0.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT);
//activate test mrt shader (glUseProgram)
this->testMRTShader.activateShader();
//draw color to target buffer
this->testMRTShader.testMRT();
//deactivate shader
this->testMRTShader.deactivateShader();
//deactivate FBO
this->fbo.deactivateFBO();
//blit selected display color attachment to back buffer
glBindFramebuffer(GL_READ_FRAMEBUFFER,this->fbo.fboID);
this->fbo.selectReadBufferByIndex(displayColorAttachmentIndex);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER,0);
glViewport(0,0,this->screenWidth,this->screenHeight);
glBlitFramebuffer( 0, 0,fbo.width,fbo.height,
0, 0,this->screenWidth,this->screenHeight,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
//swap buffer
glfwSwapBuffers();
//report error
OGLControl::reportError();
}
at runtime the program select target buffer as
location 0 = GL_COLOR_ATTACHMENT0
location 1 = GL_COLOR_ATTACHMENT1
location 2 = GL_COLOR_ATTACHMENT2
location 3 = GL_COLOR_ATTACHMENT3
and then render fullscreen quad using TestMRTShader.
after the MRT operation the program perform blitting by selecting target color attachment using
variable “displayColorAttachmentIndex”
user can press button 0,1,2,3 to select which target color buffer to display at runtime (initial value is 0).
The correct result as running on Catalyst 10.1-10.3 and GF9800GT should be
press 0 —> display color attachment 0 = red screen
press 1 —> display color attachment 1 = green screen
press 2 —> display color attachment 2 = blue screen
press 3 —> display color attachment 3 = yellow screen
but on Catalyst 10.4 the result are
press 0 —> display color attachment 0 = blue screen
press 1 —> display color attachment 1 = green scrren
press 2 —> display color attachment 2 = red screen
press 3 —> display color attachment 3 = yellow screen
the test program can be download here