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

Resolution incorrect? #20

Open
mizlan opened this issue Aug 13, 2021 · 8 comments
Open

Resolution incorrect? #20

mizlan opened this issue Aug 13, 2021 · 8 comments

Comments

@mizlan
Copy link

mizlan commented Aug 13, 2021

(Compiling and running the example code)

The pixels do not fit the box. The white square that is supposed to track the cursor tracks the position in the black window, so the issue seems to be that the pixels do not fill up the frame. Wrong pixel size? It seems to be half the length and width. Also, trying to set the window larger errors with "ERROR: The specified window dimensions do not fit on your screen" when it in theory should fit. My screen is 2880x1800 on a MacBook Pro.

Screen Shot 2021-08-13 at 4 38 24 PM

@MumflrFumperdink
Copy link
Owner

That is weird. What does GetScreenPixelSize() return?

@Safariminer
Copy link

I have the exact same issue. I tried printf()-ing out GetScreenPixelSize().x, and it returned 4, although, I specified 1 in my code.

        Island game;
        if (game.Construct(500, 350, 1, 1))
                game.Start();

@slangev
Copy link

slangev commented Nov 14, 2021

I'm having the same issue as well. Adjusting glutReshapeWindow() is a workaround, but FillRect would still be wrong.

@MumflrFumperdink
Copy link
Owner

Can you try adding (false, false, true) to the end of the Construct function?

@slangev
Copy link

slangev commented Nov 15, 2021

I tried it and it didn't make any difference. The only time I can see a difference is when I reshape the window with something like this on line 4877.
glutReshapeWindow(((15/2) + 0.5) * 32, (10/2) * 32);
When I use a debugger, these are my local values. Maybe they are different for you?
Debug values

@rafmillan
Copy link

Any followup? I am also running into this issue on latest version.

@slangev
Copy link

slangev commented May 11, 2022

No followup from me. I had to use something else not related to PGE on my project.

@rafmillan
Copy link

I solved the issue.
Look for glViewport(pos.x, pos.y, size.x, size.y); in the header file and replace with glViewport(pos.x, pos.y, size.x * 2, size.y * 2);. Bug waqs due to passing the window size, which is in screen coordinates, to glViewport, which works with pixels. On macOS with a Retina display, screen coordinates and pixels do not map 1:1. Use the framebuffer size, which is in pixels, instead of the window size. See (https://www.glfw.org/docs/latest/window.html) for details.

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

No branches or pull requests

5 participants