Browse Source

Corrected minor framebuffer issue on OpenGL ES 2.0

pull/1381/head
raysan5 4 years ago
parent
commit
04406c0f1a
1 changed files with 1 additions and 5 deletions
  1. +1
    -5
      src/rlgl.h

+ 1
- 5
src/rlgl.h View File

@ -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;

Loading…
Cancel
Save