PDA

View Full Version : color alpha?



bsabiston
01-24-2013, 11:01 AM
Hello,

When I set my vertex color in my glsl vertex shader like this, it doesn't do what I expect. Specifically I expect that setting the alpha to 0 would cause the vertex to be transparent. But it isn't. The color stays there pretty visibly, and seems to get lighter. Why is that? Are they supposed to be pre-multiplied or something, where the following color might be illegal?

colorVarying = vec4(0.3,0.1,0.75, 0.0);

Thanks
Bob

tonyo_au
01-24-2013, 01:51 PM
You have to enable blending before the alpha value has an effect

http://www.opengl.org/archives/resources/faq/technical/transparency.htm

bsabiston
02-04-2013, 09:11 AM
Yes, it is enabled. I do see transparency, but just not how I expect. Basically I am accustomed to thinking "oh if I want a half-transparent red color, will set it to RGBA 1.0 0.0 0.0 0.5"

But it appears that for me at least, I would have to tell openGL 0.5 0.0 0.0 0.5 to get something half transparent. Basically, with red set at 1.0, it does not seem to have much effect changing the alpha value. It looks about the same at .75 alpha as .01 alpha. It doesn't seem right to me.

Bob