PDA

View Full Version : Can't get alpha blended textures to behave properly...




cwolves
Apr 21, 2009, 01:55 AM
I can't for the life of me get two png textures to render on top of one-another properly when the top one has partial transparency.

http://farm4.static.flickr.com/3583/3462146738_d201e2b35d_o.png

The above image shows three renders. One using polygons (a blue square with a white diamond and 50% opacity on top of it, blending mode: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA))

And two with textures. One using the "normal" rendering mode, the other using the "premultiplied" rendering mode, at least according to forums...

All I want is to reproduce the first result using textures....


Oh, and I've LITERALLY tried every blending mode possible with glBlendFunc.



lazydog
Apr 21, 2009, 02:48 AM
Stupid question, but have you enabled blending?


glEnable( GL_BLEND ) ;


Oh and also what texture mode are you using? I use white polygons with the modulate mode:-


glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) ;


b e n