PDA

View Full Version : Semi-transparent blending?



von
04-29-2003, 03:45 PM
My goal is to render semi-tranparent geometry using a texture's alpha values. In the texture's alpha channel, black is transparent, white is opaque, and everything in between is partially transparent. I am having trouble with the in between part. It seems like any alpha value that is not totally white is completely transparent.

My blending function is:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

I am working in windows and I am curious if the cAlphaBits field of the pixelformatdescriptor is important. Changing it from 0 to 8 had no effect. Is there some obvious setting in OpenGL that I am forgetting? Can OpenGL even do this kind of blending?

Thanks in response,

Von

nexusone
04-29-2003, 05:45 PM
You that is now most people do it, I would have to see how you are setting the alpha channel.

but you can just use the glcolor4f(r,g,b,a) to set the object alpha

a = 1.0 non-transparent, 0.0 transparent, 0.5 simi-transparent.



Originally posted by von:
My goal is to render semi-tranparent geometry using a texture's alpha values. In the texture's alpha channel, black is transparent, white is opaque, and everything in between is partially transparent. I am having trouble with the in between part. It seems like any alpha value that is not totally white is completely transparent.

My blending function is:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

I am working in windows and I am curious if the cAlphaBits field of the pixelformatdescriptor is important. Changing it from 0 to 8 had no effect. Is there some obvious setting in OpenGL that I am forgetting? Can OpenGL even do this kind of blending?

Thanks in response,

Von