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

[CORE,RLGL] Fix scale issues when ending a mode #3746

Merged
merged 3 commits into from
Jan 29, 2024

Conversation

JeffM2501
Copy link
Contributor

There are 3 places in raylib that set the OpenGL modelview matrix scale to the screen scale (for HighDPI).
1 of these is incorrect, BeginMode2d, as the camera is going to do it's own scale.
The other two assume that when we end 2d and 3d mode that we are going back to the screen. That is not always true. BeginMode2d/3d can be used with a render texture and a render texture can be any size and doesn't have to match the screen DPI scale (it's not a screen).

This PR exposes the GL function to get the active draw FBO, and then has raylib use that to know what render target it is restoring to, and if it needs to apply the scale.

This change should make using a render texture more consistent.

@JeffM2501
Copy link
Contributor Author

For testing, I ran several examples, ones that do and don't use render textures and camera modes. I tested them in both high DPI and regular dpi modes and everything continued to work as expected

@raysan5 raysan5 merged commit bebf954 into raysan5:master Jan 29, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Jan 29, 2024

@JeffM2501 thanks for the improvement!

raysan5 added a commit that referenced this pull request Jan 29, 2024
@JeffM2501 JeffM2501 deleted the scale_restore branch May 3, 2024 04:33
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.

3 participants