Hello Guest

4k monitor scaling on windows

  • 2 Replies
  • 5886 Views
4k monitor scaling on windows
« on: August 28, 2018, 17:33:08 »
I have a huge 4k monitor, and my problem is similar to this: https://github.com/glfw/glfw/issues/676

They added two new hints:
  • - GLFW_WIN32_DPI_RESIZE
  • - GLFW_X11_DPI_RESIZE

What do you think, when it will be in LWJGL?

So in code level, this is my code that calculates what is the screen scale factor. On a retina macbook it returns 2, on a simple full HD monitor it returns 1. The problem, that on the 4K monitor it returns 1 as well.

Code: [Select]
glfwGetWindowSize(EngineProperties.activeWindowID, widthScreenCoordBuf, heightScreenCoordBuf);
glfwGetFramebufferSize(EngineProperties.activeWindowID, widthPixelsBuf, heightPixelsBuf);

EngineProperties.screenScaleFactor = (int) Math.floor(widthPixelsBuf.get() / widthScreenCoordBuf.get());

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: 4k monitor scaling on windows
« Reply #1 on: August 28, 2018, 20:02:08 »
The hints will be added as soon as the relevant commits make it to GLFW's master branch (which means they're fully tested and stable).

Note that, if you'd like to test it now, you can easily create a custom GLFW build and use that instead of the one provided by LWJGL (see org.lwjgl.system.Configuration.GLFW_LIBRARY_NAME).

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: 4k monitor scaling on windows
« Reply #2 on: September 29, 2018, 22:16:48 »
This will be available in LWJGL 3.2.1 snapshot 3. Instead of separate hints for each platform, there's just one hint in the final version: GLFW_SCALE_TO_MONITOR.