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

Maximize the window only shows the lower left image, a quarter of the screen #7

Open
zaichenhu opened this issue Sep 13, 2020 · 2 comments

Comments

@zaichenhu
Copy link

Desktop Screenshot 2020 09 13 - 11 41 22 49 (2)

@zaichenhu
Copy link
Author

I have resolved this problem, beacuse when the window was resized, glfwSetWindowSizeCallback function didn't set the glViewport as (0, 0, width, height). hope you could fix this bug. thank you.

@Douglasdc3
Copy link

@skyohorizon Are you running a high-dpi screen?

https://www.glfw.org/docs/3.3/window_guide.html#window_size mentions this possible issue. If you run normal monitor it will have a screen / pixel mapping of 1:1, 4k screens (retina mac) have a 1:2 mapping.

When you give glViewPort(0,0, 1080, 768) while the monitor is actually using 2px per 1 screen pixels and thus you should multiply them by 2.

However you can also get these values using the mentioned method in the documentation

int width, height;
glfwGetFramebufferSize(window, &width, &height);
glViewport(0, 0, width, height);

I have had a similar issue and used the framebuffer size method without any issues.

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

2 participants