librw icon indicating copy to clipboard operation
librw copied to clipboard

Fix for high-dpi resolution when using OpenGL

Open SubstituteR opened this issue 3 years ago • 18 comments

This is a fix for https://github.com/aap/librw/issues/63

Other device apis should be checked for regressions. There is an added inline for the null device that returns a scaling factor of 1,1 but unsure if this alone is enough to satisfy other apis.

SubstituteR avatar Feb 24 '21 05:02 SubstituteR

Looks like I'll have to add the null to the other devices.

SubstituteR avatar Feb 24 '21 05:02 SubstituteR

this fixes GTA3, but causes scaling issues on vice city when using an external monitor (mac M1)

halpz avatar Feb 25 '21 10:02 halpz

(external monitor was working fine for both before)

halpz avatar Feb 25 '21 10:02 halpz

actually it still only fills 1/4 of the screen in both on my M1 macbook pro screen

halpz avatar Feb 25 '21 10:02 halpz

this fixes GTA3, but causes scaling issues on vice city when using an external monitor (mac M1)

Can you describe the issue? I haven’t built Vice City on my M1. As for the overall size, was that a problem on GTA 3 as well? I don’t have an external monitor, so I can’t reliably test that. On my M1 with hidpi on and off though I have no problem.

SubstituteR avatar Feb 25 '21 16:02 SubstituteR

I clone your fork and drop the librw folder into the vendor folder of the game project, build all targets and on my macbook screen, the video doesn't fill the whole screen, just a portion of it (in both gta3 and vice city)

halpz avatar Feb 25 '21 16:02 halpz

screenshot: https://i.imgur.com/IlxajkA.jpg

halpz avatar Feb 25 '21 16:02 halpz

screenshot: https://i.imgur.com/IlxajkA.jpg

Strange, which macbook and which version of OSX? On my end both VC and III work fine. Screen Shot 2021-02-25 at 12 08 28 PM Screen Shot 2021-02-25 at 12 07 22 PM

SubstituteR avatar Feb 25 '21 17:02 SubstituteR

latest OS and MBP M1 16gb, maybe i'm making a mistake, what's your build process?

halpz avatar Feb 25 '21 17:02 halpz

latest OS and MBP M1 16gb, maybe i'm making a mistake, what's your build process?

I use GMAKE2 from the premake. make config=release_macosx-arm64-librw_gl3_glfw-oal all I had to update the make files to point to the homebrew folder though. I have the same laptop but 8GB model. What is your display settings?

SubstituteR avatar Feb 25 '21 17:02 SubstituteR

Same for me. No special settings - should it work by simply replacing the librw folder with yours? Or is there another step ?

halpz avatar Feb 25 '21 17:02 halpz

Same for me. No special settings - should it work by simply replacing the librw folder with yours? Or is there another step ?

I changed and pulled the latest. I could see about uploading a build from my machine to see the behavior on yours.

SubstituteR avatar Feb 25 '21 19:02 SubstituteR

Happy to try it to rule out any mistakes on my side !

halpz avatar Feb 25 '21 21:02 halpz

Happy to try it to rule out any mistakes on my side !

http://pocketdevs.org/re3

Drop that in your install directory and then just ./re3.

SubstituteR avatar Feb 25 '21 22:02 SubstituteR

This looks extremely hacky and I won't merge it unless there is absolutely no other way around it. Would be better to figure out what the actual cause for the bug is. my opengl code isn't the best so it's quite likely it can be fixed cleanly.

aap avatar Feb 26 '21 12:02 aap

This looks extremely hacky

I agree

Would be better to figure out what the actual cause for the bug is.

When trying to fix it, changing the frame buffer manually to the w,h from glfwGetFramebufferSize properly renders the game-world, but as OpenGL operates on relative units, the menu / 2D layer becomes small (half resolution on x and y)

I've never used OpenGL before, but I can keep looking. You can see a similar issue https://stackoverflow.com/questions/12821144/how-to-draw-text-in-opengl-on-mac-os-with-retina-display

SubstituteR avatar Feb 26 '21 15:02 SubstituteR

Did anyone come up with robust solution for this. I'm on an Intel Mac with Monterey and it's an issue when using a HiDPI display preference with librw master. See

Screen Shot 2022-10-27 at 10 30 31 pm

palmerj avatar Oct 27 '22 20:10 palmerj

Ok this is resolved for me by using glfw 3.3.8. Nice got it working well on a intel macbook!

palmerj avatar Oct 30 '22 21:10 palmerj