Skip to content
Snippets Groups Projects
Commit 843814b9 authored by slevy's avatar slevy
Browse files

Select additive blending if TXF_ADD textures.

parent 38ecc9b4
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ int txbind( Texture *tx, int *enabled )
tx->report &= ~(1<<ctx);
}
#endif
wantblend = (tx->flags & (TXF_ALPHA|TXF_INTENSITY)) ? BLEND_ON : BLEND_OFF;
wantblend = (tx->flags & (TXF_ALPHA|TXF_INTENSITY|TXF_ADD)) ? BLEND_ON : BLEND_OFF;
wantenv =
tx->apply == TXF_DECAL ? GL_DECAL
......@@ -184,9 +184,14 @@ int txbind( Texture *tx, int *enabled )
if(wanted != *enabled) {
if(wanted & BLEND_ON) {
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.03 );
if(tx->flags & TXF_ADD) {
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
glDisable( GL_ALPHA_TEST );
} else {
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_ALPHA_TEST );
glAlphaFunc( GL_GREATER, 0.03 );
}
} else if(wanted & BLEND_OFF) {
glDisable( GL_BLEND );
glDisable(GL_ALPHA_TEST);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment