LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: [Solved] glfwGetVideoMode and UHD monitor under macOS  (Read 186 times)

BrickFarmer

  • Talks Too Much
  • ***
  • Offline Offline
  • Posts: 103
[Solved] glfwGetVideoMode and UHD monitor under macOS
« on: January 14, 2018, 23:24:25 »

The info button on my monitor is showing 3840x2160, but glfwGetVideoMode is reporting 1920x1080.  Is there a scaling factor involved under the hood somewhere like on iOS? About this mac -> displays shows  (3840 x 2160) and I am using 'Default for Display' in the display preferences -> display -> resolution.  I'm a bit confused where the difference is coming from?
Logged
Oculus Rift CV1, MBP 2016 - 2.9 i7 - Radeon Pro 460  OSX 10.12.4,  Win7 - i5 4670K - GTX1070.
Oculus Rift VR Experiments: https://github.com/WhiteHexagon

BrickFarmer

  • Talks Too Much
  • ***
  • Offline Offline
  • Posts: 103
Re: glfwGetVideoMode and UHD monitor under macOS
« Reply #1 on: January 15, 2018, 10:26:35 »

So it turns out that there is some scaling in macOS, the 'Default' option is ignoring the monitor resolution. But by doing the magic hidden Alt-Click on 'Scaled' option a list of actual resolutions shows up, and from there it's clear macOS is defaulting to 1920x1080.  Although having tried the UHD mode, and as nice as the LWJGL looks, my eyes are just too old for text that small :)

oh and glfwGetVideoMode is obviously working perfectly fine.

btw using any other scaled option apart from 1920x1080 and 3840x2160 shows a warning 'using a scaled resolution may affect performance'.  I'll try these out when I have more than a cube to performance test against!
Logged
Oculus Rift CV1, MBP 2016 - 2.9 i7 - Radeon Pro 460  OSX 10.12.4,  Win7 - i5 4670K - GTX1070.
Oculus Rift VR Experiments: https://github.com/WhiteHexagon

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1939
Re: [Solved] glfwGetVideoMode and UHD monitor under macOS
« Reply #2 on: January 15, 2018, 11:23:14 »

Note that when creating a 1920x1080 window on macOS with GLFW, the window will cover the entire screen. However, the framebuffer backing that window will have the retina 3840x2160 resolution. You can get the framebuffer resolution using glfwGetFramebufferSize or the framebuffer size callback. To disable retina scaling, use glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_FALSE) before creating the window.
Logged

BrickFarmer

  • Talks Too Much
  • ***
  • Offline Offline
  • Posts: 103
Re: [Solved] glfwGetVideoMode and UHD monitor under macOS
« Reply #3 on: January 15, 2018, 11:39:12 »

Just tested that, and that seems to be true of the internal MBP display. On the external display, the framebuffer size seems to match the screen size regardless of the hint.  Whether or not I use the macOS scaled mode at HD or UHD.  Which is good right?
Logged
Oculus Rift CV1, MBP 2016 - 2.9 i7 - Radeon Pro 460  OSX 10.12.4,  Win7 - i5 4670K - GTX1070.
Oculus Rift VR Experiments: https://github.com/WhiteHexagon

spasi

  • Administrator
  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1939
Re: [Solved] glfwGetVideoMode and UHD monitor under macOS
« Reply #4 on: January 15, 2018, 13:39:05 »

I'm not familiar with how macOS handles external displays. What is the native resolution of the external display?
Logged

BrickFarmer

  • Talks Too Much
  • ***
  • Offline Offline
  • Posts: 103
Re: [Solved] glfwGetVideoMode and UHD monitor under macOS
« Reply #5 on: January 15, 2018, 14:30:43 »

UHD 3840x2160
Logged
Oculus Rift CV1, MBP 2016 - 2.9 i7 - Radeon Pro 460  OSX 10.12.4,  Win7 - i5 4670K - GTX1070.
Oculus Rift VR Experiments: https://github.com/WhiteHexagon