Blending transparent textures with depth

Posted by l.thee.a on Stack Overflow See other posts from Stack Overflow or by l.thee.a
Published on 2010-05-22T11:17:15Z Indexed on 2010/05/22 11:20 UTC
Read the original article Hit count: 456

Filed under:
|
|

I am trying to blend textures which have transparent areas:

glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, ...);
glVertexPointer( 2, GL_FLOAT, 0, ... );
glEnable (GL_BLEND);
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );

Unless I add glDisable(GL_DEPTH_TEST), transparent parts of the top textures overwrite everything beneath them (instead of blending). Is there any way to do this without disabling depth? I have tried various blending functions but none of the helped.

© Stack Overflow or respective owner

Related posts about opengl-es

Related posts about textures