Original Post
🔒 Locked
transparent texturing
Advertisement
You can do it through an alpha channel and either alpha testing (faster, but less options) or blending (slower, but more options). While you''re reading the texture into a buffer, test each pixel. If the pixel is the color you want transparent, insert an alpha value of 0x00, otherwise insert an alpha value of 0xFF. Make sure to retain the alpha channel by storing the texture as GL_RGBA internally.
[Resist Windows XP''s Invasive Production Activation Technology!]
[Resist Windows XP''s Invasive Production Activation Technology!]
I have been trying something similar. The software implementation of OpenGL (the MS version anyway) doesn't support blending, so I wanted to make this work via alpha testing.. but how exactly does that work? I have tried enabling GL_ALPHA_TEST, and setting the alpha func to GL_NOTEQUAL, 0.0f (thinking that would make any pixels with an alpha channel not equal to zero pass the test and thus be rendered into the color buffer), but that doesn't seem to work. Actually, it does something, but not what I want. The pixels that should be "transparent" are rendered as white pixels. Am I missing something? (I want pixels with an alpha channel equal to zero to be transparent) Also, I am setting the GL_TEXTURE_ENV_MODE to GL_DECAL, so the current glColor() value shouldn't affect anything right?
Also, I am processing the image during load to insert an alpha channel and set it appropriately (I have a certain RGB tuple I look for to determine which pixels get alpha 0x00, or alpha 0xff. And I am specifying GL_RGBA for the internal format and image format in glTexImage2D().
-Brannon
Edited by - Brannon on December 16, 2001 5:36:55 AM
Also, I am processing the image during load to insert an alpha channel and set it appropriately (I have a certain RGB tuple I look for to determine which pixels get alpha 0x00, or alpha 0xff. And I am specifying GL_RGBA for the internal format and image format in glTexImage2D().
-Brannon
Edited by - Brannon on December 16, 2001 5:36:55 AM
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement