图像显示的黑色背景的OpenGL ES的Andr​​oid

图像显示的黑色背景的OpenGL ES的Andr​​oid

问题描述:

我玩弄的OpenGL ES在Android上,我想我的应用程序显示图像。当我显示图像(图像规格为64×64像素)我得到的图像上的黑色背景,但是当我把这个code:

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?

您需要使用混合。像这样的东西应该工作:

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);

您可以使用这一事实 glAlphaFunc 并获得的关闭的给你的结果表明,图像本身是好的,至少。

The fact that you can use glAlphaFunc and get close to your result suggests that the image itself is okay at least.