图像显示的黑色背景的OpenGL ES的Andr​​oid [英] Image displayed with black background OPENGL ES Android

查看:368
本文介绍了图像显示的黑色背景的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.

这篇关于图像显示的黑色背景的OpenGL ES的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆