When I have a texture that has transparency (and an alpha channel), the transparent areas seem to be coming through as vec4s with values (0, 0, 0, 1). It’s easy enough to discard any color coming through that has an alpha value of 0 (apparently the 0 is still there…). But this is also causing problems with transparency between 0 and 1. Everything just shows up fully opaque and I can’t for the life of my imagine what is causing it.
Here’s what my shader looks like. I’ve been playing with it quite a bit, but this is currently the one I’m dealing with. Just putting through alpha values always a 0.5f, to see what happens. Still fully opaque:
#version 150 core
uniform sampler2D sampler;
in vec4 pass_Color;
in vec2 pass_TextureCoord;
in float pass_alpha;
out vec4 frag_Color;
void main(void) {
frag_Color = pass_Color;
vec3 color = texture2D(sampler, pass_TextureCoord);
frag_Color = vec4(color, pass_alpha);
}
I don’t know lwjgl, but seeing it is based on opengl, you may have to enable Blending. Assuming the pass_alpha is calculated correctly in the vertex shader.
Also, the first line in main doesn’t do anything becaus frag_color is overwritten in the last line.