raylib icon indicating copy to clipboard operation
raylib copied to clipboard

Fix ScissorMode for RenderTextures on macOS

Open Not-Nik opened this issue 2 years ago • 4 comments

ScissorMode would previously use the window height when repositioning the scissor origin to the top left.

Not-Nik avatar Feb 10 '23 13:02 Not-Nik

Actually, now it seems something is off with HighDPI scaling

Not-Nik avatar Feb 10 '23 13:02 Not-Nik

I previously tested ignoring DPI settings for render textures completely, but that might not be what you want @raysan5

Vector2 scale;
if (CORE.Window.renderTexture) scale = (Vector2) {1, 1};
else scale = GetWindowScaleDPI();
rlScissor((int)(x*scale.x), (int)(CORE.Window.currentFbo.height*scale.y - (((y + height)*scale.y))), (int)(width*scale.x), (int)(height*scale.y));

Not-Nik avatar Feb 10 '23 13:02 Not-Nik

@Not-Nik I'm afraid this issue has been reviewed many times and there is always some side case (macOS version, CPU platform, display type) that fails and the issue comes again. I don't know what is the best solution for it, I considered leaving all HighDPI management to user but some raylib internal parts are not directly accessible for that...

raysan5 avatar Feb 11 '23 12:02 raysan5

I feel like render textures shouldn't be affected by high DPI, because they are rarely ever used for 2d interfaces. Also creation is independent of the current DPI value, so having scissor mode be affected by it seems inconsistent

Not-Nik avatar Feb 12 '23 15:02 Not-Nik

I'm closing this draft. HighDPI and macOS implies many considerations.

raysan5 avatar Apr 10 '23 09:04 raysan5