If(GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER) != GLES20. A framebuffer is generally complete if: At least one buffer has been attached (e.g. GLuint frameBuffer glGenFramebuffers ( 1, &frameBuffer) You can not use this framebuffer yet at this point, because it is not complete. GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texture, 0) The first thing you need is a framebuffer object to manage your new framebuffer. GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, framebuffer) GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE) GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE) GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR) GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR) GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null) I'm attaching the screenshot made on Samsung Galaxy Y S5360 (I'm not aware if this issue occur on other devices) as well as the code responsible for off-screen framebuffer/texture creation: GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture) Everything else is rendered on off-screen texture which is then rendered on the main framebuffer. Regarding the screenshot attached below, the red bar on the left is drawn on the main framebuffer and because of that it is properly displayed. I wasn't aware of the issue as on most devices this problem doesn't exists and everything is drawn just fine. I have a problem with the rendering to texture in my Android based game (OpenGl ES2.0).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |