ogle234
12-15-2005, 06:33 AM
Hi
I need help with blending textures e.g - draw an airplane and then put an insignia on its wing -
say a cross.
I am doing the following in the WGL/OpenGL environment
1) create a bitmap using createDIBSection with an alpha channel
2) clear it with black and alpha =0
3) draw the red cross to it with alpha = 1
4) make a texture out of it using GL_RGBA, GL_UNSIGNED_BYTE
5) put this texture on the screen using GL_DECAL
It doesn't work - instead it pastes the texture with the last colour drawn to screen!
so say I drew a yellow object last and then draw this texture
on the wing - I just see a yellow square.
If I use GL_REPLACE I get a wing with a black square & red cross inside it. - NOT what I want.
The way red book describes DECAL -is that is GL_RGBA is used then
" C = Cf(1-At) + CtAt, A = Af
a subscript of t indicates a texture value,
f indicates the incoming fragment value,
and no subscript indicates the final, computed value"
I have checked that the bitmap that I create and the screen are both capable and correctly
hold alpha information.
what am I doing wrong?!!
stuckontexture
I need help with blending textures e.g - draw an airplane and then put an insignia on its wing -
say a cross.
I am doing the following in the WGL/OpenGL environment
1) create a bitmap using createDIBSection with an alpha channel
2) clear it with black and alpha =0
3) draw the red cross to it with alpha = 1
4) make a texture out of it using GL_RGBA, GL_UNSIGNED_BYTE
5) put this texture on the screen using GL_DECAL
It doesn't work - instead it pastes the texture with the last colour drawn to screen!
so say I drew a yellow object last and then draw this texture
on the wing - I just see a yellow square.
If I use GL_REPLACE I get a wing with a black square & red cross inside it. - NOT what I want.
The way red book describes DECAL -is that is GL_RGBA is used then
" C = Cf(1-At) + CtAt, A = Af
a subscript of t indicates a texture value,
f indicates the incoming fragment value,
and no subscript indicates the final, computed value"
I have checked that the bitmap that I create and the screen are both capable and correctly
hold alpha information.
what am I doing wrong?!!
stuckontexture