Search code examples
opengl-esshaderglsles

why object is looking gray instead being transparent when alpha parameter of gl_FragColor is lower than 1 in fragment shader


When I set the alpha value of gl_FragColor to 1 here is the result. Render with alpha value of gl_FragColor set to 1

However if I set it to 0.5 thats what I see, but not anything transperent is this normal?

enter image description here


Solution

  • Have you enabled alpha blending in your renderer?

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    

    More meaty stuff: Tutorial 10 : Transparency