From 04406c0f1a0a1d05cc0dfd03e43119c4f7bfdf4d Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 18 Sep 2020 02:14:05 +0200 Subject: [PATCH] Corrected minor framebuffer issue on OpenGL ES 2.0 --- src/rlgl.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index d32d20db..3a25e7e8 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -2909,7 +2909,6 @@ void *rlReadTexturePixels(Texture2D texture) unsigned int fboId = rlLoadFramebuffer(texture.width, texture.height); // TODO: Create depth texture/renderbuffer for fbo? - glBindFramebuffer(GL_FRAMEBUFFER, fboId); glBindTexture(GL_TEXTURE_2D, 0); @@ -2921,13 +2920,10 @@ void *rlReadTexturePixels(Texture2D texture) pixels = (unsigned char *)RL_MALLOC(GetPixelDataSize(texture.width, texture.height, UNCOMPRESSED_R8G8B8A8)); glReadPixels(0, 0, texture.width, texture.height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); - // Re-attach internal FBO color texture before deleting it - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fbo.texture.id, 0); - glBindFramebuffer(GL_FRAMEBUFFER, 0); // Clean up temporal fbo - rlUnloadFramebuffer(fbo); + rlUnloadFramebuffer(fboId); #endif return pixels;