My rendering pipeline goes something like this-

Bind multisampled FBO

Render GameObjects

Render Transparent Objects

Blit multisampled FBO to normal FBO

perform any Post processing

Render a quad with the result

Render GUI

I've found I can render transparent objects in the "Render transparent Objects" function, but alpha blending against the post processing quad doesn't work. Is there any reason why this would be? This draw call is used regardless of whether it is being rendered to the FBO, or to the screen buffer It is a button in particular I'm trying to render, here is the draw call:





//Bind uniforms..... code skipped


glBindTexture(GL_TEXTURE_2D, texture);

glDrawArrays(GL_QUADS, 0, 4);


Let me know if there is anything I need to provide to help. Again, same shaders are used in both cases, so I don't think the shaders are the problem, but here they are anyway:

#version 330
uniform sampler2D textureImage;

// input packet

in packet{
    vec2 textureCoord;
} inputFragment;

// output packet
layout(location = 0) out vec4 fragmentColour;

void main(void) {

vec3 gamma = vec3(1.0 / 2.2);
vec4 tempFragmentColour = texture2D(textureImage,     inputFragment.textureCoord);
    fragmentColour = vec4(pow(tempFragmentColour.xyz, gamma),     tempFragmentColour.a);
//  fragmentColour = vec4(tempFragmentColour.a);


I have tried writing in the alpha values manually in the shaders and I get the same effect.

Working with OpenGL 4.6 on PC with c++

  • 1
    \$\begingroup\$ I don't know which platform you're working on, but usually, if you're rendering to multisample-enabled FBOs, you need to use multisample-enabled depth and stencil buffers. Likewise, if you're rendering to non-multisample-enabled color buffers (like the screen), you need to use non-multisample-enabled depth and stencil buffers. May I suggest you double check all your buffers are correctly setup? \$\endgroup\$ – Panda Pajama Apr 14 '19 at 16:09
  • \$\begingroup\$ Sorry, will add to question I'm working with openGL 4.6 on PC. I'm fairly sure because I'm drawing straight to the screen, there are no buffers to tweak? How does one define what specs the screen buffer has? \$\endgroup\$ – Figwig Apr 14 '19 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.