How can I determine the correct window size in Windows 10? (SDL2)

I am working on an OpenGL application. I use a screen with a high resolution per inch, and the Windows GUI is scaled to 125% so that the programs look on a regular screen.

If I create a 800 * 600 window using SDL2, it will be the same size as on a regular screen, but it is 1000 * 750 pixels. Since I use delayed rendering, I have to create buffers with the same size as the drawing area, so I would like to know the actual size of the window in pixels.

If I call SDL_GL_GetDrawableSize, I get 800 * 600 incorrectly instead of 1000 * 750. I added a flag SDL_WINDOW_ALLOW_HIGHDPIwhen creating the window.

How am I wrong?


Edit

If I change the DPI Awareness in Visual Studio to a high DPI monitor , then the window is really 800 * 600, but it looks small. It should be 1000 * 750, because the scaling factor in Windows settings is 125%

+4
source share

Source: https://habr.com/ru/post/1691349/


All Articles