Android / opengles alpha textures are not translucent, but binary transparent

I draw some textures with an alpha channel, but when they appear, it looks like the alpha channel is only binary. Thus, the pixel is transparent or opaque, although the pixel is translucent in the texture file itself. Mixing is configured as follows:

gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);

Is there any workaround?

The above shows how it should look, and below shows how it is done:

alt text

+5
source share
4 answers

Try the following:

gl.glEnable(GL10.GL_BLEND);    
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

gl.glEnable(GL10.GL_ALPHA_BITS);
//draw...
gl.glDisable(GL10.GL_ALPHA_BITS);
+3
source

, - -, . , , :

gl.glDisable(GL10.GL_ALPHA_TEST);
+1

GLSurfaceView? () ?

surfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);

EGL -. ...

surfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);

: , , , OpenGL glTexImage2D?

0

PNG GL, 1 , 16- 5-5-5-1? .

0

All Articles