Hello,
I am working on Multiple Render Target (MRT) stuff. I have two
RGBA8 color textures attached to my FBO. Everything is fine
without MSAA.
But when I activate MSAA for the FBO I get this strange effect (see image):
While the content of the 2nd color attachment (the GBuffer, not shown here) looks as expected,
the content of the 1st color attachment (RGBA) looks weird. Namely as if the triangles are more
and more “blended” with the black background as the MSAA sample count increases (getting darker).
The strange thing is, this happens although blending is disabled
glDrawBuffers(2, &Buffers[0]); // Buffers contains GL_COLOR_ATTACHMENT0 and GL_COLOR_ATTACHMENT1
glDisable(GL_BLEND);
glDrawElements(GL_TRIANGLES, ... );
I can “fix” the effect by telling OpenGL not to modify the alpha channel of the 1st color attachment:
[i]
glColorMaski( 0, true, true, true, false);
glDrawElements(GL_TRIANGLES, ... );
[/i]
This is the relevant shader code:
out vec4 Color; // defines color in 1st color attachment
out vec4 Color1; // defines color in 2nd color attachment
void main(void)
{
Color = CalculateColor(...does not matter...);
if (Color.r <= 1.0) Color = vec4(1.0); // For debugging purposes just set the color to white for the 1st color attachment
Color1 = SetGBuffer(...does not matter...);
Color1.a = 1.0; // For debugging purposes just set the alpha to one for the 2nd color attachment
}
The names of the shader outs (Color, Color1) are set before linking the program via glBindFragDataLocation().
The shader code is validated and works fine. The FBO is also validated and complete. There are no OpenGL errors reported.
I really need help with this, I am debugging this issue for so long and I am out of ideas what could be the reason =/
Help is really appreciated!