Framebuffer在启动时没有工作,但工作正常

时间:2018-01-10 20:30:11

标签: opengl-es framebuffer

我的应用程序中创建了一个帧缓冲区。 每次我卸载应用程序,然后通过eclipse再次运行它不起作用。但每次之后我都会通过eclipse运行它确实有效!因此,在全新安装它永远不会第一次工作,但当我再次运行应用程序时它的罚款。有任何想法吗?感谢

GLES20.glGenTextures(1, temp2, 0);
fboTex = temp2[0];
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, fboTex);
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 1024, 512, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glGenFramebuffers(1, temp, 0);
MyGLRenderer.fboId = temp[0];
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, MyGLRenderer.fboId);
GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, fboTex, 0);
GLES20.glGenRenderbuffers(1, temp3, 0);
renderBufferId = temp3[0];
GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, renderBufferId);
GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16, MyGLRenderer.mFboW, MyGLRenderer.mFboH);
GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, renderBufferId);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, 0);
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

0 个答案:

没有答案