我可以在 OpenGL ES 2.0的函数onDrawFrame
中生成纹理吗?GLSurfaceRenderer
例如,我使用的代码如下所示。
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, MyTexture);
int[] mNewTexture = new int[weight * height * 4];
for(int ii = 0; ii < weight * height; ii = ii + 4){
mNewTexture[ii] = 127;
mNewTexture[ii+1] = 127;
mNewTexture[ii+2] = 127;
mNewTexture[ii+3] = 127;
}
IntBuffer texBuffer = IntBuffer.wrap(mNewTexture);
GLES20.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, weight, height, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, texBuffer);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
pmF.drawSelf(MyTexture);
并且pmF
代码中的类用于使用纹理来渲染屏幕。我注意到这段代码被执行了。但是屏幕上没有显示结果。