Color-keying in OpenGL?

Started by
2 comments, last by Kelly G 18 years, 3 months ago
Is there an OpenGL texture equivalant to DirectDraw's color keying (i.e. all pixels of a specified color are not drawn)? I realize that this concept has been phased-out in favor of the much more flexable alpha blending but I would like a way that I can take an OpenGL texture that I've already established with glTexImage2D (internal format RGB), and later set all the pixels of a particular color to be transparent. Is it possible, or do I already need to have added alpha values to the pixel map that I pass to glTexImage2D?
Advertisement
You could probably do this with a shader... :)
"Game Maker For Life, probably never professional thou." =)
Quote:Original post by Kelly G
Is there an OpenGL texture equivalant to DirectDraw's color keying (i.e. all pixels of a specified color are not drawn)? I realize that this concept has been phased-out in favor of the much more flexable alpha blending but I would like a way that I can take an OpenGL texture that I've already established with glTexImage2D (internal format RGB), and later set all the pixels of a particular color to be transparent. Is it possible, or do I already need to have added alpha values to the pixel map that I pass to glTexImage2D?


the color keying is not hardware accelerated and so directx converts your image before uploading it to agp memory, which is also what you will have to do in opengl.

Projects: Top Down City: http://mathpudding.com/

Rasmadrak: True. I hadn't thought of that. But my old Geforce 2 has no shader support. Since this is a 2-D application anyway, I might as well keep so it runs on lousy graphics cards too. I'll keep that in mind but I might just have to add those alpha channels in instead. Thanks.

This topic is closed to new replies.

Advertisement