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

MacOS X: Using window size instead of frame buffer size #2318

Open
IntellectualKitty opened this issue Nov 12, 2023 · 6 comments
Open

MacOS X: Using window size instead of frame buffer size #2318

IntellectualKitty opened this issue Nov 12, 2023 · 6 comments

Comments

@IntellectualKitty
Copy link

On my Mac, content is drawn only in the lower left quarter of the window because the frame buffer is 2x2 times the resolution of the window on the Retina display thingy.

I'm notccompletely fluent on the details, I just have experience with this with GLFW. And they solve this -- and explain it pretty clearly, too! -- by using glfwGetFramebufferSize instead of glfwGetWindowSize for the call to glViewport.

@paulhoux
Copy link
Collaborator

paulhoux commented Nov 14, 2023

Isn't this somehow being solved using the Cinder function toPixels()? Or is there a problem with window creation only, which may not be accessible code for the average user?

See also: https://github.com/cinder/Cinder/blob/4e27a4a5e66fd63000e98afa09d0d0419119ee6b/include/cinder/app/Window.h#L301C1-L312C74

@IntellectualKitty
Copy link
Author

IntellectualKitty commented Nov 14, 2023

It's been a while since I used Cinder, but the OpenGL ShadowMapping sample is a nice base for me to build from, and Cinder is always easy to work with.

Anyway, when built and ran the sample, it was drawing to the lower-left quarter of the window, a symptom I often come across on my Mac, hence my familiarity with it.

I don't know if toPixels() solves this or not. I did try to find a getFramebufferSize() as a counterpart to getWindowSize() in the App code, but didn't find anything. (That's the standard solution that I'm familiar with.)

My issue is that an app should draw to the whole window right out of the box. But thanks for the tip about toPixels()!

@IntellectualKitty
Copy link
Author

I've checked, and toPixels() is being called when the viewport is being set with the window size.

When I take out the toPixels() call, it doesn't change. I did notice that getContentScale(), which is what toPixels() uses, defaults to 1.0f...

@IntellectualKitty
Copy link
Author

I apologize. This may or may not be the issue. The architecture and base SDK settings are incorrect for the current main branch (I freshly downloaded Cinder) when using CMake to generate an Xcode project for the library; the samples seem to have the same erroneous settings as well (e.g., x486_64).

Resetting the architecture to standard architectures and the base SDK to macOS in the pull-down list for both the library and the samples seems to work. I was able to run other samples now, and they are scaled correctly, when they didn't build before.

Sadly, the ShadowMapping still doesn't work, but I'm on a new project now, and don't have time to figure out what's wrong. I started modifying it and who knows what I did to it...

Anyway, I hope the information is helpful.

Thanks again!

@paulhoux
Copy link
Collaborator

Thanks for your report, anyway! I currently do not have access to a Mac, so I can't attempt to fix your issue myself. But it seems to me that getContentScale() should return something else than 1.0.

On Windows, I seem to recall that the application manifest needs to be changed to enable high pixel density settings. And perhaps something similar needs to be done on the Mac. If your SDK or other settings are out of date, that probably doesn't help.

Perhaps someone else finds time to look at this. The information presented above may help.

@axjxwright
Copy link
Contributor

On Windows, I seem to recall that the application manifest needs to be changed to enable high pixel density settings. And perhaps something similar needs to be done on the Mac. If your SDK or other settings are out of date, that probably doesn't help.

Yep, to opt out of retina mode you can set High Resolution Capable to NO in your Info.plist

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

3 participants