Reputation: 5
I'm using OpenGL ES 1.0 for Android. I've a shape composed by 2 triangles (quad) like a play card. The texture used for this play card have smooth corners (transparent)
When i draw the shape... enable blend function in this way:
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
If i draw only one card all work fine!!!
But, when i draw many cards... and add some rotations, i can see the corners of the shape:
How can i have transparent effects on all frames? There is a way to replace the blending on all frame?
Upvotes: 0
Views: 1002
Reputation: 35943
You would probably be better served by alpha testing glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.1f);
than by blending, because when using blending you must sort your to draw them from front to back.
It looks like you're drawing the top card first, and then drawing the cards underneath it, while with blending you must draw the bottom card first for it to blend properly.
Upvotes: 2