作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的应用程序中,我尝试使用纹理,但出现错误
:0: SGXQueueTransfer: all paths failed
:0: HardwareMipGen: Failed to generate texture mipmap levels (error=3)
在我的 Galaxy Nexus 上。我的 EVO 4G 上没有出现这些错误。
这里是相关的加载代码。
private static int load(Context context, int resID) {
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),
resID);
int[] texts = new int[1];
GLES20.glGenTextures(1, texts, 0);
int texID = texts[0];
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
GLES20.GL_REPEAT);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
return texID;
}
private static int loadWithMipmap(Context context, int resID) {
int texID = load(context, resID);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR_MIPMAP_NEAREST);
GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D);
return texID;
}
知道发生了什么以及我该如何解决它吗?
编辑:只有一张图片导致错误,它是一张 1024x2048 png。
最佳答案
我看到了这个,一旦我将图像挤压成正方形,它就起作用了。 OpenGL 不会报错。
关于android - glGenerateMipmap IMGSRV 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11065721/
在我的应用程序中,我尝试使用纹理,但出现错误 :0: SGXQueueTransfer: all paths failed :0: HardwareMipGen: Failed to generate
我是一名优秀的程序员,十分优秀!