Windows High DPI Display and Window/Frame Size


#1

Hello,

I’m trying to see what I can do with GLFW (3.3) on a high DPI display, Windows 10.

My display is 3000x2000 pixels, 2x DPI

On win32/GLFW if I ask for a 1500x1000 window, with GLFW_SCALE_FOR_MONITOR enabled I get a 3000x2000 window size AND a 3000x2000 framebuffer size, and it renders at 30FPS if I’m lucky.
When using high DPI I was expecting the window size to be reported as 1500x1000, i.e. the screen size, and the framebuffer to be 3000x2000, i.e. the pixel size.

You can see this effect in the opacity test - it requests a 400x400 window and gets 800x800 reported by both glfwGetWindowSize() and glfwGetFramebufferSize().

Am I misunderstanding something here?

(Ideally, I’d like a frame buffer at the reduced size too, with some magic scaling in the background. The UWP/DirectX version of the same program is totally convinced that the screen is 1500x1000 pixels, and runs happily at 60FPS - This is a static testcard image, so it’s not like it’s doing any work.)


#2

The documentation for GLFW_SCALE_TO_MONITOR states:

GLFW_SCALE_TO_MONITOR specified whether the window content area should be resized based on the monitor content scale of any monitor it is placed on.

So if you ask for a 400x400 window you will get an 800x800 window, which is what you get. If you want a 400x400 pixel size window then don’t set GLFW_SCALE_TO_MONITOR.

On windows opengl it’s not possible with GLFW (and I’m not sure it’s possible in general) to get a framebuffer of a different size to the actual window size. You could use render targets or FBOs to draw to a different resolution and then copy to the window render target.


#3

Ah, so it doesn’t attempt to pretend it’s not a retina display.
I’ll see if setting up a smaller FBO helps. Ta!