我想将.PVR
图像用于纹理目的。
为此,我在 drawables-mdpi 中使用PVRtextool
并加载了我的图像。
现在,当我在我的项目中使用它时,应用程序就会崩溃。 pvr
我错过了一些步骤吗?
请指导。
这是我遇到问题的加载纹理代码。 resource
包含.pvr
格式的图像。
static void loadTexture(GL10 gl, Context context, int[] resource)
{
gl.glGenTextures(n, textureIDs, 0);
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inScaled = false;
for (int face = 0; face < n; face++)
{
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureIDs[face]);
bitmap[face] = BitmapFactory.decodeResource(
context.getResources(), resource[face],opts);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap[face], 0);
bitmap[face].recycle();
}
]