FBO creation code:
glGenFramebuffersEXT(1, &data_fbo.fbo);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, data_fbo.fbo);
glGenTextures(1, &data_fbo.data);
glBindTexture(GL_TEXTURE_2D, data_fbo.data);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, data_fbo.width, data_fbo.height, 0, GL_RGBA, GL_FLOAT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, data_fbo.data, 0);
then the fragment program that writes to the FBO does:
gl_FragData[0] = vec4( 0.5,0.8,0.5, 0.1 );
then finally, for testing what was written to the FBO, i run a fragment program that binds back the normal framebuffer, and binds the FBO texture (data_fbo.data) as regular texture, and tried the following code (writing a fullscreen quad)
vec4 data = texture2D( data_fbo_tex, gl_TexCoord[0].st );
gl_FragColor.rgb = data.rgb;
which works flawlessly (i see the color 0.5, 0.8, 0.5)
but if instead, i write this line:
gl_FragColor.rgb = vec(1,1,1) * data.a;
Everything is white, instead of color 0.1,0.1,0.1, which is what i expect, given it’s what i saved into the alpha component.