PDA

View Full Version : setting color key in OpenGL



mdive
06-06-2003, 06:54 AM
Hello.

In OpenGL system, I should guess that color key for alpha-blending is black{glColor(0.0f, 0.0f, 0.0f)}.

Well, How do I change this color key? I want to change black color key for white one.

If you have any advice, I'm glad to hear your advice.

sorry, my broken English.
Thanks.

dorbie
06-06-2003, 07:47 AM
No, OpenGL has no color key built in. It has red, green, blue and alpha channels (a.k.a. components). To make something transparent you set the alpha component to zero. For semi transparency you set somewhere between 0 and 1 and for opaque rendering you set it to 1. This is all independent of the red green and blue components. It applies to vertex colors and texture colors where you have a texture format that supports alpha.

You also need to enable blending etc.

mdive
06-06-2003, 07:17 PM
Thank you very much for your advice.

I have been misunderstanding about OpenGL alpha blending function.

I intend to study about glBlendFunc more.

I'm glad to hear your advice.
Thanks.