|
|
@ -3403,7 +3403,7 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format) |
|
|
|
|
|
|
|
// Attach our texture to FBO |
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0); |
|
|
|
|
|
|
|
|
|
|
|
// We read data as RGBA because FBO texture is configured as RGBA, despite binding another texture format |
|
|
|
pixels = (unsigned char *)RL_MALLOC(rlGetPixelDataSize(width, height, RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8)); |
|
|
|
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
|
|
@ -3541,11 +3541,14 @@ bool rlFramebufferComplete(unsigned int id) |
|
|
|
void rlUnloadFramebuffer(unsigned int id) |
|
|
|
{ |
|
|
|
#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)) && defined(RLGL_RENDER_TEXTURES_HINT) |
|
|
|
|
|
|
|
// Query depth attachment to automatically delete texture/renderbuffer |
|
|
|
int depthType = 0, depthId = 0; |
|
|
|
glBindFramebuffer(GL_FRAMEBUFFER, id); // Bind framebuffer to query depth texture type |
|
|
|
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &depthType); |
|
|
|
|
|
|
|
// TODO: Review warning retrieving object name in WebGL |
|
|
|
// WARNING: WebGL: INVALID_ENUM: getFramebufferAttachmentParameter: invalid parameter name |
|
|
|
// https://registry.khronos.org/webgl/specs/latest/1.0/ |
|
|
|
glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &depthId); |
|
|
|
|
|
|
|
unsigned int depthIdU = (unsigned int)depthId; |
|
|
|