Reputation: 1
Hi I am playing around with OPENGL Es on ANdroid and I am trying to display an image on my app. When I display the image ( image specs is 64x64 pixels ) I get a black background on the image but when I put this code:
public void draw(GL10 gl) {
...
..
gl.glAlphaFunc( GL10.GL_GREATER, 0 );
The black background disappears but I get strange colors in my image.
Does anybody have an idea on how to fix this?
Upvotes: 0
Views: 1034
Reputation: 13877
You need to use blending. Something like this should work:
gl.glEnable(gl.GL_BLEND);
gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINE_SRC_ALPHA);
The fact that you can use glAlphaFunc
and get close to your result suggests that the image itself is okay at least.
Upvotes: 1