PDA

View Full Version : alpha blend not working?



supagu
12-25-2004, 05:29 AM
alpha testing used to work, now it doesnt, i dont know why, but here is how i set up blending:



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

glDisable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.0);
i see no blending with my texture! BUT... when i specify say 0.5 for alpha via a shader, i see the blending, its as if the alpha of my textures isnt actually working?

and i've also stepped through the texture loader to make sure proper alpha values are being loaded in, and this all apears to be correct.

Overmind
12-25-2004, 09:12 AM
What texture environment mode do you use? Do you use combiners or fragment shaders?

For example in DECAL mode the final alpha value has nothing to do with the texture alpha, it is taken from the interpolated vertex colors. With REPLACE it is taken from the texture...

supagu
12-25-2004, 02:17 PM
i was thinking it has to do with my vertex colours, how can i reset the texture combiners back to default value?

i've tried:


glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA_EXT, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_CONSTANT_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_EXT, GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_EXT, GL_PREVIOUS_EXT);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA_EXT, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_EXT, GL_SRC_ALPHA);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1.0f);
glTexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1.0f);
with no luck. this shows vertex colours combined with texture, but still not using the textures alpha for blending :-/