summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.h
diff options
context:
space:
mode:
authorJeffery Myers <[email protected]>2024-01-29 12:10:23 -0800
committerGitHub <[email protected]>2024-01-29 21:10:23 +0100
commitbebf9547bd244727fa06a2ce1db2faf474ba23ad (patch)
tree8c2d88b708d2fb9bcd01cd40b59ef68383a46d6d /src/rlgl.h
parent812645b077dbd5579ee5e03d89a6a07f431bf3c6 (diff)
downloadraylib-bebf9547bd244727fa06a2ce1db2faf474ba23ad.tar.gz
raylib-bebf9547bd244727fa06a2ce1db2faf474ba23ad.zip
[CORE,RLGL] Fix scale issues when ending a mode (#3746)
* Only restore GL scale back to screen scale if we are returning to a screen, not a render texture. * blankspace * reset back to default screen scale when ending a render texture since we are back on the default fbo
Diffstat (limited to 'src/rlgl.h')
-rw-r--r--src/rlgl.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 6ad6394d..6dd3eb2c 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -621,6 +621,7 @@ RLAPI void rlDisableShader(void); // Disable shader progra
// Framebuffer state
RLAPI void rlEnableFramebuffer(unsigned int id); // Enable render texture (fbo)
RLAPI void rlDisableFramebuffer(void); // Disable render texture (fbo), return to default framebuffer
+RLAPI unsigned int rlGetActiveFramebuffer(void); // Returns the active render texture (fbo), 0 for default framebuffer
RLAPI void rlActiveDrawBuffers(int count); // Activate multiple draw color buffers
RLAPI void rlBlitFramebuffer(int srcX, int srcY, int srcWidth, int srcHeight, int dstX, int dstY, int dstWidth, int dstHeight, int bufferMask); // Blit active framebuffer to main framebuffer
RLAPI void rlBindFramebuffer(unsigned int target, unsigned int framebuffer); // Bind framebuffer (FBO)
@@ -1725,6 +1726,17 @@ void rlEnableFramebuffer(unsigned int id)
#endif
}
+// return the active render texture (fbo)
+unsigned int rlGetActiveFramebuffer(void)
+{
+#if (defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES3)) && defined(RLGL_RENDER_TEXTURES_HINT)
+ GLint fboId = 0;
+ glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &fboId);
+ return fboId;
+#endif
+ return 0;
+}
+
// Disable rendering to texture
void rlDisableFramebuffer(void)
{