-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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] BeginScissorMode() fails on macOS #1281
Comments
@Bambofy Oh, this is weird... I tried on Windows and it works ok. Maybe it could be related to HighDPI display, there are some related issues on macOS... are you using a retina/highDPI display? |
yep it is a HighDPI display |
I'm closing this issue, already #1086 open regarding HighDPI on macOS... actually it requires a full review... |
I'm getting similar problems - i don't have access to a highdpi display, but users of my code with highdpi displays are reporting similar issues. Could you clarify what you think the problem with highdpi displays is here? I can't just multiply by the DPI - even without multiplying by the DPI, you'd still expect a 200x200 rectangle to be rendered. Are the scissor screen coords different on osx maybe? |
Hmm, after a long bit of trial and error, i have this 'fix' - i have a feeling it won't work on all systems though
This is in nim, but you get the idea Looks like the OSX scissor coordinate system starts from (0, screen_height/2) (although this isn't just a bottom left coord system, since positive y = further down). Scissor coords also need to be DPI scaled... If anyone with a macbook could dig deeper i'd be grateful ;_; |
@raysan5 No it's not related to window resizing, the window is kept at the same size But i think i figured out the issue after sleeping on it: The internal scissoring method raylib uses has bottom-left coordinates (unsure if you use glScissor, but that uses bottom-left coords). Raylib transforms the coordinates you pass into it by negating + adding the screen height - but it doesn't factor in DPI at this stage. This is why it seemed like the OSX coordinate system started 'half way up' the screen, because I was viewing this error on a screen with DPI 2. It's also why the x coordinate wasn't translated, because you don't need to do any transforms on the X coord to make it work with glScissor! Unfortunately i don't currently have the freedom to use a non-prebuilt raylib, so i'll just be patching this in my application's code rather than submitting a patch :p EDIT: When do raylib prebuilts on homebrew get updated? |
It should be fixed with this pending PR #1987 |
ok! seems strange that this is related to fbo size, how does raylib do scissoring? I did think that glscissor would be quite slow for many scissors ¯_(ツ)_/¯ Also i'm not resizing the window at all, unless raylib initializes the window with a default size and then resizes when you startup |
Issue description
Using BeginScissorMode() on OS X results in nothing being drawn on the screen in the scissored area.
Environment
OS X 10.15.5
Raylib 3.0
Issue Screenshot
I'm drawing a 200x200 black square at 0,0. These images are with and without scissor at (0,0,800,600)
Without scissor:
With scissor:
Code Example
It can be reproduced with a blank raylib project and these 3 lines:
The text was updated successfully, but these errors were encountered: