Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeginScissorMode checks for render texture to avoid using GetWindowScaleDPI #3510

Merged

Conversation

gulrak
Copy link
Contributor

@gulrak gulrak commented Nov 5, 2023

When on a window with active FLAG_WINDOW_HIGHDPI window flag or on macOS the implementation of BeginScissorMode uses GetWindowScaleDPI to get scaling and uses it on the scissor rect.

If using BeginScissorMode inside of an open BeginTextureMode/EndTextureMode this scaling is
wrong as a RenderTexture is created with a defined resolution and doesn't share any implicit window dpi scalings.

I fixed this by checking if currently a frame buffer is bound to detect the texture mode. If there is a binding the else path of the original implementation will be used to avoid the wrong scaling.

@raysan5 raysan5 merged commit 56b5a5c into raysan5:master Nov 6, 2023
12 checks passed
@raysan5
Copy link
Owner

raysan5 commented Nov 6, 2023

@gulrak Thanks for the review! Just added CORE.Window.usingFbo flag to register when an FBO is being used, we can check against it. I'm merging and reviewing it myself!

@gulrak
Copy link
Contributor Author

gulrak commented Nov 9, 2023

Sorry, I was so happy for it to be merged that I missed you flipped the logic when changing the way the texture mode is detected, now it always uses GetWindowScaleDPI if we are in texture mode, but my solution (and the one needed) was the opposite (So it needs to be !CORE.Window.usingFbo.

raysan5 added a commit that referenced this pull request Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants