PDA

View Full Version : [SOLVED] using GL_DECAL



akashiraffee
01-22-2010, 11:11 AM
I want to use a texture with an alpha channel, so that the opaque parts are opaque, and the color of the object shows thru where there is transparency.

I was under the impression that was a purpose of GL_DECAL, but instead the transparent parts appear black.

How should I be doing this?

Alfonse Reinheart
01-22-2010, 11:44 AM
All GL_DECAL will do is make the fragment color you compute (combining the texture color with the previous texture environment color) be a linear blend between the texture color and previous color based on the texture's alpha.

Unless GL_BLEND is enabled, and a proper blend function/equation set, all you will get is this color with a zero alpha. You need to enable GL_BLEND and set an appropriate blend function and equation.

akashiraffee
01-22-2010, 11:59 AM
All GL_DECAL will do is make the fragment color you compute (combining the texture color with the previous texture environment color) be a linear blend between the texture color and previous color based on the texture's alpha.


Yeah, that's what I want.

Turns out it was the texture itself -- I was using raw RGBA data and must have something wrong, because switching to .tga worked.