Half transparent textures in openGL ES 2.0?

Started by
1 comment, last by Mockarutan 13 years, 1 month ago
I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.).

So what am i missing here?

Thanx for any help!

//Tobias
Advertisement

I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.).

So what am i missing here?

Thanx for any help!

//Tobias


Isn't there glEnable(GL_BLEND) and glBlendFunc in OpenGL ES?
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

[quote name='Mockarutan' timestamp='1299267556' post='4781846']
I can't figure out how to do normal alpha testing in openGL ES 2.0 on the android platform. I have tried to setup the blending factors exactly like in ES 1.1 where i get it to work, but in 2.0 it doesn't do a difference. I know that ES 2.0 is completely shader based and you are suppose to achieve many blending effects in the shader, but from what i have understood you can only to fully transparent stuff with the "discard" syntax in the shader. (unless you use multi texturing and blend the two textures together with some formula, but thats not blending with the render target.).

So what am i missing here?

Thanx for any help!

//Tobias


Isn't there glEnable(GL_BLEND) and glBlendFunc in OpenGL ES?
[/quote]

It works.... I'm embarrassed xD I guess i misunderstood a text a reed in an openGL ES 2.0 book:



Alpha test and LogicOp are no longer part of the per-fragment
operations stage. These two stages exist in OpenGL 2.0 and OpenGL
ES 1.x. The alpha test stage is no longer needed because the fragment
shader can discard fragments and therefore the alpha test can be
performed in the fragment shader. In addition, LogicOp is removed

as it is very infrequently used by applications and the OpenGL ES
working group did not get requests from independent software
vendors (ISVs) to support this feature in OpenGL ES 2.0.
[/quote]

Thanx!

This topic is closed to new replies.

Advertisement