Hello,
consider this simplified fragment shader
#version 150 core
out vec4 Color0;
out vec4 Color1;
out vec4 Color2;
void main(void)
{
Color0 = vec4(0.0, 0.0, 0.0, 0.3);
Color1 = vec4(0.0, 0.0, 0.0, 0.5);
Color2 = vec4(0.0, 0.0, 0.0, 0.8);
}
During shader linking the color outputs are mapped to draw buffer indices like this:
glBindFragDataLocation(Handle, 0, "Color0");
glBindFragDataLocation(Handle, 1, "Color1");
glBindFragDataLocation(Handle, 2, "Color2");
The FBO has 3 color attachments:
GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 and GL_COLOR_ATTACHMENT2.
Before rendering with this fragment shader, glDrawBuffers is called like this:
GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers);
[b]=> The output is as expected, each of the 3 buffers receives the proper alpha value (also the RGB terms are the proper ones, so it is not about only the alpha part here).
But now the problem:
When I call[/b] glDrawBuffers like this (because I don’t want to render to 2nd color buffer):
GLenum buffers[3] = { GL_COLOR_ATTACHMENT0, GL_NONE, GL_COLOR_ATTACHMENT2 };
glDrawBuffers(3, buffers);
[b]=> Then nothing is rendered to the 3rd color buffer! How is that possible? Where is my mistake?
[/b]Help is really appreciated!