Skip to content

[examples] Use render width for high-DPI pixel grid - #6447

Open
yex743055-sudo wants to merge 1 commit into
raysan5:masterfrom
yex743055-sudo:examples/highdpi-pixel-grid-scale
Open

yex743055-sudo wants to merge 1 commit into
raysan5:masterfrom
yex743055-sudo:examples/highdpi-pixel-grid-scale

Conversation

@yex743055-sudo

Copy link
Copy Markdown
Contributor

On Windows GLFW at 150% scaling, removing FLAG_WINDOW_HIGHDPI from core_highdpi_demo leaves both widths at 800 while GetWindowScaleDPI() still returns 1.5. The 50-pixel grid marks then appear about 33 pixels apart.

Convert framebuffer coordinates using the ratio of logical width to render width, and document how to compare with the flag disabled. This follows the DPI reporting change in #6402.

Tested on Windows 11 with Visual Studio 2022 at 100% and 150%, with HiDPI off and on. Pixel readback verified the grid in all four cases. At 100%, the captured frames were identical before and after.

@raysan5

raysan5 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

@yex743055-sudo I don't understand the issue, please, could you provide some screenshot/video illustrating the issue and the fix?

@yex743055-sudo

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look. Both screenshots were taken on Windows with GLFW at 150% display scaling. To reproduce the comparison, remove FLAG_WINDOW_HIGHDPI from the demo’s SetConfigFlags() call in both versions. The demo enables it by default.

In the first screenshot, the lower blue 750 mark is about 500 pixels from the left edge. In the second screenshot, it lines up with the orange 750 mark. The framebuffer is 800 pixels wide in both cases.

raylib-6447-before raylib-6447-after

This branch has not been deployed

No deployments
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