Skip to content

Commit

Permalink
REVIEWED: Scissor mode to support RenderTexture #3510
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Nov 6, 2023
1 parent 56b5a5c commit 8739c28
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/rcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,22 +1088,20 @@ void BeginScissorMode(int x, int y, int width, int height)

rlEnableScissorTest();

GLint id = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &id); // Test for render texture
#if defined(__APPLE__)
if(!id)
if (CORE.Window.usingFbo)
{
Vector2 scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(GetScreenHeight()*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y));
}
#else
if (!id && (CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
if (CORE.Window.usingFbo && ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0))
{
Vector2 scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height - (y + height)*scale.y), (int)(width*scale.x), (int)(height*scale.y));
}
#endif
else
else
{
rlScissor(x, CORE.Window.currentFbo.height - (y + height), width, height);
}
Expand Down

0 comments on commit 8739c28

Please sign in to comment.