• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# How do I set the color key for a texture quad?

## Recommended Posts

For example, lets say we have a .tga or a .bmp like this. Example
11111111111111111111111111111
11111111000000000011111111111
01000000000010000000111111111
11111111110000000000000000000

Afer I load it into memory with glTexImage2D() I decide that I want to blit it but not like the way it is. Lets say I want to blit it on screen but I have all of the 1''s to be ''invisible'' or not blitted(or just blit it as another color). How would I go about this? ----------------------- "In reality God is a comedian but his audience are too afraid to laugh."

##### Share on other sites
AFAIK you can''t do that in OpenGL. If you want to do something like that you can either do an image mask (see a tutorial at nehe.gamedev.net on how to do it) or add an alpha channel to the texture and use alpha testing so all texels with certain alpha values don''t get rendered.

glAlphaFunc, take a look at that to see how to do alpha testing.

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627657
• Total Posts
2978466

• 10
• 12
• 22
• 13
• 33