Alpha not changing object transparency using glsl shader

Why, when I manually change the alpha value in the array, is passed to the shader, the result is the same for both 0.0fand 1.0f?

I expected the object to be drawn with some level of transparency, depending on the alpha value.

I do not use any textures. I always see my red object on a black background.

access to the variable glslfrom java..

float[] color = {1.0f, 0.0f, 0.0f, 1.0f};

gl2.glGetUniformLocation(shaderProgram, "vColor");
gl2.glUniform4fv(mColorHandle, 1, color, 0);

glsl, fragmented shader ..

#version 120

uniform vec4 vColor;

void main() {
    gl_FragColor = vColor;
    gl_FragColor.a = 0.0; // does not make object transparent
    // gl_FragColor.a = 1.0; // does not make object transparent
}
+4
source share
1 answer

You must enable mixing ..

gl2.glEnable(GL.GL_BLEND);
gl2.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
+6
source

All Articles