3
所以,我在res/drawable-hdpi(text.png,例如)文件夹中有纹理,我如何加载这个纹理并将其与glBindTexture绑定?如何在OpenGL ES中加载和绑定纹理?
所以,我在res/drawable-hdpi(text.png,例如)文件夹中有纹理,我如何加载这个纹理并将其与glBindTexture绑定?如何在OpenGL ES中加载和绑定纹理?
Bitmap img = BitmapFactory.decodeResource(context.getResources(), R.drawable.text);
int[] texId = new int[1];
GLES20.glGenTextures(1, texId, 0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texId[0]);
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, img, 0);
GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
过滤器,我尝试用R键加载它类 –