I am new on OpenGl and what I want to achieve is to give a texture the alpha from 1.0 to 0.0

I have been searching and only found "how to load alpha in images" but I cant find how to apply alpha to an object

I has been tried with:

    alpha += 0.002f;
    if(alpha > 1) alpha = 1f;
    gl.glAlphaFunc(GL10.GL_EQUAL, alpha);

But it doesn't work.

How I can give alpha value (to make the effect of fade) to an object/texture?

  • \$\begingroup\$ I removed your code, as this doesn't really have to do with your code. The question is how to make an object transparent, not how to add it to your code. I'm not sure how to do it myself, but this is most likely going to be a shader effect. \$\endgroup\$ – MichaelHouse Nov 27 '14 at 15:16
  • \$\begingroup\$ It cant be done in OpenGL ES 1.0? \$\endgroup\$ – D4rWiNS Nov 27 '14 at 15:40

I made it!

That is the code

gl.glColor4f(1f, 1f, 1f,alpha);
alpha -= 0.002f;
if(alpha < 0) alpha = 0f;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.