PDA

View Full Version : render only non-black pixels



Dardan
05-19-2012, 09:25 AM
how can i render only non-black pixels in a texture (bmp)???
Alpha testing//?

And I know you can mask, but isnt there another less expensive way??

menzel
05-19-2012, 11:04 AM
You can give the texture an additional alpha channel, or test the color in your fragment shader and discard those fragments. To give a good advice, you have to tell us what OpenGL version you're targeting, and what you want to do exactly. Are shaders an option? Will the texture get filtered (will there be semi-transparent parts)? Do you have a lot of those textures so sorting (for alpha blending) could become a problem or is it just one texture for a GUI with fixed size? Is there a special reason to use one color as the alpha (e.g. image size, if so, why not compressed textures?) etc. etc.