4k monitor scaling on windows

Started by mudlee, August 28, 2018, 17:33:08

Previous topic - Next topic

mudlee

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.

glfwGetWindowSize(EngineProperties.activeWindowID, widthScreenCoordBuf, heightScreenCoordBuf);
glfwGetFramebufferSize(EngineProperties.activeWindowID, widthPixelsBuf, heightPixelsBuf);

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

spasi

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).

spasi

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.