【发布时间】:2012-11-01 18:15:31
【问题描述】:
我的应用程序有点问题。我使用三星 Galaxy S3 开发了我的应用程序来测试它,结果一切正常! 但问题来了,在我完成应用程序后,我开始在其他设备上进行测试。该应用程序可以在其他 Galaxy S3 和 Galaxy S 上完美运行。但是当我尝试在 Sony Xperia 和 LG Optimus Net Dual 上运行它时,屏幕只是变黑了!
更有趣的是,这些设备上的应用,声音功能还可以,广告出现,应用完美触碰,却只画黑屏!这真的很奇怪......就像他们不支持opengles 2但他们支持并且android版本是Xperia上的4.0 ICS和LG上的2.2!
有人知道这是什么吗?还是遇到了类似的问题?如果有人想要代码,请说并在此处发布!感谢您的帮助!
编辑:
我的加载纹理:
public static int loadTexture(final int ResourceId, final int min_filter, final int mag_filter) {
for (int i=0;i<nTextures;i++) if (Textures[i*2]==ResourceId) return Textures[i*2+1];
int[] textureHandle = new int[1];
GLES20.glGenTextures(1, textureHandle, 0);
if (textureHandle[0] != 0)
{
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
final Bitmap bitmap = BitmapFactory.decodeResource(GLRenderer.mContext.getResources(), ResourceId, options);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle[0]);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, min_filter);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, mag_filter);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,GLES20.GL_CLAMP_TO_EDGE);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0,GLES20.GL_RGBA, bitmap, 0);
bitmap.recycle();
}
if (textureHandle[0] == 0) throw new RuntimeException("Error loading texture.");
Textures[nTextures*2]=ResourceId;
Textures[nTextures*2+1]=textureHandle[0];
nTextures++;
return textureHandle[0];
}
编辑 2:
我的 GLSurfaceView 的创建:
GLActivityView(GLActivity context) {
super(context);
setEGLContextClientVersion(2);
// getHolder().setFormat(PixelFormat.TRANSLUCENT);
// setEGLConfigChooser(8, 8, 8, 8, 8, 8);
renderer = new GLRenderer(context);
setRenderer(renderer);
}
【问题讨论】:
标签: android drawing opengl-es-2.0