glfw3 video mode problem

o-san wrote on Friday, June 07, 2013:

Hello again

I am having problems converting my old 2.7 fullscreen code to 3.0. When running windowed mode everything seems to work as expected.

I’ve successfully compiled and run all but one of the glfw3 test programs, the modes.exe behaves unexpectedly.

When I start the modes.exe (from command prompt, it won’t stay open through a double click in windows), I expected it to create a window for the different modes but this does not happen. The error log from modes.exe -t is as follows.


I:\temp\glfw\tests>modes -h
Usage: modes [-t]
modes -h

I:\temp\glfw\tests>modes -t
Testing mode 0 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 59 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 0: 37416816 x 5196792 x 1152 (0 0 1152) 7274605 Hz
Testing mode 1 on monitor Allm+ñn PnP-bildsk+ñrm: 6619236 x 3014771 x 7864522 (7
864421 101 0) 0 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 1: 640 x 480 x 16 (5 6 5) 60 Hz
Testing mode 2 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 67 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 2: 640 x 480 x 16 (5 6 5) 67 Hz
Testing mode 3 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 72 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 3: 0 x 0 x 37398874 (1 1 37398872) 4098 Hz
Testing mode 4 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 1351833604 (1314376949
47023 37409632) 5196792 Hz
Error: Invalid window size
Failed to enter mode 4: 0 x 0 x 1351833604 (1314376949 47023 37409632) 5196792 H
z
Testing mode 5 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 0 (0 0 0) 0 Hz
Error: Invalid window size
Failed to enter mode 5: 0 x 0 x 0 (0 0 0) 0 Hz
Testing mode 6 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 0 (0 0 0) 0 Hz
Error: Invalid window size
Failed to enter mode 6: 0 x 0 x 0 (0 0 0) 0 Hz
Testing mode 7 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 1832626299 (1795162474
47009 37416816) 5177540 Hz
Error: Invalid window size
Failed to enter mode 7: 0 x 0 x 1832626299 (1795162474 47009 37416816) 5177540 H
z
Testing mode 8 on monitor Allm+ñn PnP-bildsk+ñrm: 65536 x 16781315 x 0 (0 0 0) 0
Hz
Error: Win32: Failed to set video mode
Failed to enter mode 8: 24 x 39970 x 1 (0 0 1) 1 Hz


etc. Last entry:


Testing mode 57 on monitor Allm+ñn PnP-bildsk+ñrm: 37398872 x 4098 x 995544448 (
0 0 995544448) 134264751 Hz
*** Color bit mismatch: (8 8 8) instead of (0 0 995544448)
*** Size mismatch: 65535x4098 instead of 37398872x4098
Closing window

I:\temp\glfw\tests>


The monitor name and video parameters are all messed up, as far as I can tell. When viewing the monitor name in the windows-change resolution screen, the monitor name shows up correctly.

Fullscreen worked in 2.x, same monitor and hardware.

Any advice appreciated.

o-san wrote on Friday, June 07, 2013:

I got a single monitor set-up, Cintiq 24HD Touch, windows 7.

elmindreda wrote on Friday, June 07, 2013:

What is the output of the modes test without any arguments?

o-san wrote on Friday, June 07, 2013:

Oh sorry, should have posted that too…


Name: Allmän PnP-bildskärm (primary)
Current mode: 1920 x 1200 x 24 (8 8 8) 60 Hz
Virtual position: 0 0
Physical size: 677 x 423 mm (72 dpi)
Modes:
0: 640 x 480 x 16 (5 6 5) 59 Hz
1: 640 x 480 x 16 (5 6 5) 60 Hz
2: 640 x 480 x 16 (5 6 5) 67 Hz
3: 640 x 480 x 16 (5 6 5) 72 Hz
4: 640 x 480 x 16 (5 6 5) 75 Hz
5: 800 x 600 x 16 (5 6 5) 56 Hz
6: 800 x 600 x 16 (5 6 5) 60 Hz
7: 800 x 600 x 16 (5 6 5) 72 Hz
8: 800 x 600 x 16 (5 6 5) 75 Hz
9: 1024 x 768 x 16 (5 6 5) 60 Hz
10: 1024 x 768 x 16 (5 6 5) 70 Hz
11: 1024 x 768 x 16 (5 6 5) 75 Hz
12: 1280 x 720 x 16 (5 6 5) 60 Hz
13: 1280 x 768 x 16 (5 6 5) 60 Hz
14: 1280 x 768 x 16 (5 6 5) 75 Hz
15: 1280 x 800 x 16 (5 6 5) 60 Hz
16: 1280 x 800 x 16 (5 6 5) 75 Hz
17: 1360 x 768 x 16 (5 6 5) 60 Hz
18: 1366 x 768 x 16 (5 6 5) 60 Hz
19: 1280 x 960 x 16 (5 6 5) 60 Hz
20: 1280 x 960 x 16 (5 6 5) 75 Hz
21: 1440 x 900 x 16 (5 6 5) 60 Hz
22: 1280 x 1024 x 16 (5 6 5) 60 Hz
23: 1280 x 1024 x 16 (5 6 5) 75 Hz
24: 1360 x 1024 x 16 (5 6 5) 60 Hz
25: 1680 x 1050 x 16 (5 6 5) 60 Hz
26: 1600 x 1200 x 16 (5 6 5) 60 Hz
27: 1920 x 1080 x 16 (5 6 5) 60 Hz
28: 1920 x 1200 x 16 (5 6 5) 60 Hz
29: 640 x 480 x 24 (8 8 8) 59 Hz
30: 640 x 480 x 24 (8 8 8) 60 Hz
31: 640 x 480 x 24 (8 8 8) 67 Hz
32: 640 x 480 x 24 (8 8 8) 72 Hz
33: 640 x 480 x 24 (8 8 8) 75 Hz
34: 800 x 600 x 24 (8 8 8) 56 Hz
35: 800 x 600 x 24 (8 8 8) 60 Hz
36: 800 x 600 x 24 (8 8 8) 72 Hz
37: 800 x 600 x 24 (8 8 8) 75 Hz
38: 1024 x 768 x 24 (8 8 8) 60 Hz
39: 1024 x 768 x 24 (8 8 8) 70 Hz
40: 1024 x 768 x 24 (8 8 8) 75 Hz
41: 1280 x 720 x 24 (8 8 8) 60 Hz
42: 1280 x 768 x 24 (8 8 8) 60 Hz
43: 1280 x 768 x 24 (8 8 8) 75 Hz
44: 1280 x 800 x 24 (8 8 8) 60 Hz
45: 1280 x 800 x 24 (8 8 8) 75 Hz
46: 1360 x 768 x 24 (8 8 8) 60 Hz
47: 1366 x 768 x 24 (8 8 8) 60 Hz
48: 1280 x 960 x 24 (8 8 8) 60 Hz
49: 1280 x 960 x 24 (8 8 8) 75 Hz
50: 1440 x 900 x 24 (8 8 8) 60 Hz
51: 1280 x 1024 x 24 (8 8 8) 60 Hz
52: 1280 x 1024 x 24 (8 8 8) 75 Hz
53: 1360 x 1024 x 24 (8 8 8) 60 Hz
54: 1680 x 1050 x 24 (8 8 8) 60 Hz
55: 1600 x 1200 x 24 (8 8 8) 60 Hz
56: 1920 x 1080 x 24 (8 8 8) 60 Hz
57: 1920 x 1200 x 24 (8 8 8) 60 Hz (current mode)

elmindreda wrote on Friday, June 07, 2013:

Interesting bug. Try current master. It should work on Windows now.

o-san wrote on Friday, June 07, 2013:

Tried it just now (https://github.com/glfw/glfw), still get the same results with -t.


I:\temp\glfw\tests>modes -t
Testing mode 0 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 59 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 0: 0 x 1073751168 x 39979 (9 39970 0) 0 Hz
Testing mode 1 on monitor Allm+ñn PnP-bildsk+ñrm: 1 x 1 x 37009778 (37005680 409
8 0) 60 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 1: 1 x 1 x 37009778 (37005680 4098 0) 60 Hz
Testing mode 2 on monitor Allm+ñn PnP-bildsk+ñrm: 561969588 x 201378696 x 107375
2459 (0 1073752448 11) 39970 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 2: 561969588 x 201378696 x 1073752459 (0 1073752448 11) 399
70 Hz
Testing mode 3 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 37005682 (1 1 37005680
) 4098 Hz
Error: Invalid window size
Failed to enter mode 3: 0 x 0 x 37005682 (1 1 37005680) 4098 Hz
Testing mode 4 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 52105 x 813679940 (6123012
33 201378696 11) 7798980 Hz
Error: Invalid window size
Failed to enter mode 4: 0 x 52105 x 813679940 (612301233 201378696 11) 7798980 H
z
Testing mode 5 on monitor Allm+ñn PnP-bildsk+ñrm: 561969588 x 201378701 x -21474
75956 (0 -2147475968 12) 39970 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 5: 561969588 x 201378701 x -2147475956 (0 -2147475968 12) 3
9970 Hz
Testing mode 6 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 37005682 (1 1 37005680
) 4098 Hz
Error: Invalid window size
Failed to enter mode 6: 0 x 0 x 37005682 (1 1 37005680) 4098 Hz
Testing mode 7 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 813679941 (612301233 2
01378696 12) 7798980 Hz
Error: Invalid window size
Failed to enter mode 7: 0 x 0 x 813679941 (612301233 201378696 12) 7798980 Hz
Testing mode 8 on monitor Allm+ñn PnP-bildsk+ñrm: 561969588 x 201378701 x -21474
77617 (0 -2147477632 15) 39970 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 8: 561969588 x 201378701 x -2147477617 (0 -2147477632 15) 3
9970 Hz
Testing mode 9 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 0 x 37005682 (1 1 37005680
) 4098 Hz
Error: Invalid window size
Failed to enter mode 9: 0 x 0 x 37005682 (1 1 37005680) 4098 Hz
Testing mode 10 on monitor Allm+ñn PnP-bildsk+ñrm: 0 x 52105 x 813679944 (612301
233 201378696 15) 7798980 Hz
Error: Invalid window size
Failed to enter mode 10: 0 x 52105 x 813679944 (612301233 201378696 15) 7798980
Hz

elmindreda wrote on Friday, June 07, 2013:

Yup, bad fix. Try now.

o-san wrote on Friday, June 07, 2013:

Thanks for looking into this. I still get many error messages… however the last resolution test works (test 57, native desktop resolution).

I:\temp\glfw\tests>modes -t
Testing mode 0 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 59 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 0: 640 x 480 x 16 (5 6 5) 59 Hz
Testing mode 1 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 60 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 1: 640 x 480 x 16 (5 6 5) 60 Hz
Testing mode 2 on monitor Allm+ñn PnP-bildsk+ñrm: 640 x 480 x 16 (5 6 5) 67 Hz
Error: Win32: Failed to set video mode
Failed to enter mode 2: 640 x 480 x 16 (5 6 5) 67 Hz

Testing mode 55 on monitor Allm+ñn PnP-bildsk+ñrm: 1600 x 1200 x 24 (8 8 8) 60 H
z
Error: Win32: Failed to set video mode
Failed to enter mode 55: 1600 x 1200 x 24 (8 8 8) 60 Hz
Testing mode 56 on monitor Allm+ñn PnP-bildsk+ñrm: 1920 x 1080 x 24 (8 8 8) 60 H
z
Error: Win32: Failed to set video mode
Failed to enter mode 56: 1920 x 1080 x 24 (8 8 8) 60 Hz
Testing mode 57 on monitor Allm+ñn PnP-bildsk+ñrm: 1920 x 1200 x 24 (8 8 8) 60 H
z
Framebuffer resized to 1920x1200
Closing window

I also tried changing the windows/desktop resolution to something else (1280 x 800 x 24). That made that particular test work (test 44 and 45).


Testing mode 43 on monitor Allmän PnP-bildskärm: 1280 x 768 x 24 (8 8 8) 75 Hz

Error: Win32: Failed to set video mode
Failed to enter mode 43: 1280 x 768 x 24 (8 8 8) 75 Hz
Testing mode 44 on monitor Allmän PnP-bildskärm: 1280 x 800 x 24 (8 8 8) 60 Hz

Closing window
Testing mode 45 on monitor Allmän PnP-bildskärm: 1280 x 800 x 24 (8 8 8) 75 Hz

Closing window
Testing mode 46 on monitor Allmän PnP-bildskärm: 1360 x 768 x 24 (8 8 8) 60 Hz

Error: Win32: Failed to set video mode
Failed to enter mode 46: 1360 x 768 x 24 (8 8 8) 60 Hz
Testing mode 47 on monitor Allmän PnP-bildskärm: 1366 x 768 x 24 (8 8 8) 60 Hz

Error: Win32: Failed to set video mode
Failed to enter mode 47: 1366 x 768 x 24 (8 8 8) 60 Hz
Testing mode 48 on monitor Allmän PnP-bildskärm: 1280 x 960 x 24 (8 8 8) 60 Hz

Error: Win32: Failed to set video mode

elmindreda wrote on Friday, June 07, 2013:

Some progress has been made at least. I’ll be back on Sunday.

vittoriolassini wrote on Saturday, June 08, 2013:

Hi, i’m having same problems on current master (Win 7 32 bit, MinGW, Nvidia 560Ti, Dell UltraSharp 2311H, current resolution 1920 x 1080). Basically, any attempt to use resolution that isn’t current end up in failure.
I’ve tried to display result of ChangeDisplaySettingsEx() call in win32_monitor.c (i’ve modified call to _glfwInputError() in the case when result is not DISP_CHANGE_SUCCESSFUL) and that small code change severely altered behavior of modes.exe. It switched modes for some time and finally hanged up. It also produced following output:
Testing mode 0 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 59 Hz
Framebuffer resized to 640x480
Closing window
Testing mode 1 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 2 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 3 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 4 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 5 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 6 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 7 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 8 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 9 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 10 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 11 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 59 Hz
Closing window
Testing mode 12 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 13 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 14 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 15 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 16 on monitor Dell U2311H(Digital): 1152 x 864 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 17 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 18 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 19 on monitor Dell U2311H(Digital): 1360 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 20 on monitor Dell U2311H(Digital): 1366 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 21 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 22 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 23 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 60 Hz
Framebuffer resized to 1280x1024
Closing window
Testing mode 24 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 25 on monitor Dell U2311H(Digital): 1600 x 900 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 26 on monitor Dell U2311H(Digital): 1600 x 1024 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 27 on monitor Dell U2311H(Digital): 1680 x 1050 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 28 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 29 Hz
Framebuffer resized to 0x0

Inspection of machine code of executable showed that compiler added one stack variable (for the result of ChangeDisplaySettingsEx() call) and changed position of other locals in stack frame.
After that, i’ve tried to insert call ZeroMemory(&dm, sizeof(DEVMODE)) before any assignments to dm fields. It produced another output:

Testing mode 0 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 59 Hz
Framebuffer resized to 640x480
Closing window
Testing mode 1 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 2 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 3 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 4 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 5 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 6 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 7 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 8 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 9 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 60 Hz
Framebuffer resized to 1024x768
Closing window
Testing mode 10 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 11 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 59 Hz
Closing window
Testing mode 12 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 13 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 14 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 15 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 16 on monitor Dell U2311H(Digital): 1152 x 864 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 17 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 18 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 19 on monitor Dell U2311H(Digital): 1360 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 20 on monitor Dell U2311H(Digital): 1366 x 768 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 21 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 22 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 23 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 24 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 75 Hz
Closing window
Testing mode 25 on monitor Dell U2311H(Digital): 1600 x 900 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 26 on monitor Dell U2311H(Digital): 1600 x 1024 x 16 (5 6 5) 60 Hz
Framebuffer resized to 1600x1024
Closing window
Testing mode 27 on monitor Dell U2311H(Digital): 1680 x 1050 x 16 (5 6 5) 60 Hz
Closing window
Testing mode 28 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 29 Hz
Closing window
Testing mode 29 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 30 Hz
Framebuffer resized to 0x0
*** Color bit mismatch: (8 8 8) instead of (5 6 5)
*** Size mismatch: 0x0 instead of 1920x1080
Closing window
Testing mode 30 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 59 Hz
Closing window
Testing mode 31 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 60 Hz
Framebuffer resized to 0x0
*** Color bit mismatch: (8 8 8) instead of (5 6 5)
*** Size mismatch: 0x0 instead of 1920x1080
Closing window
Testing mode 32 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 59 Hz
Closing window
Testing mode 33 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 34 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 35 on monitor Dell U2311H(Digital): 720 x 480 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 36 on monitor Dell U2311H(Digital): 720 x 480 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 37 on monitor Dell U2311H(Digital): 720 x 576 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 38 on monitor Dell U2311H(Digital): 720 x 576 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 39 on monitor Dell U2311H(Digital): 800 x 600 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 40 on monitor Dell U2311H(Digital): 800 x 600 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 41 on monitor Dell U2311H(Digital): 1024 x 768 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 42 on monitor Dell U2311H(Digital): 1024 x 768 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 43 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 59 Hz
Closing window
Testing mode 44 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 45 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 46 on monitor Dell U2311H(Digital): 1280 x 768 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 47 on monitor Dell U2311H(Digital): 1280 x 768 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 48 on monitor Dell U2311H(Digital): 1152 x 864 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 49 on monitor Dell U2311H(Digital): 1280 x 800 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 50 on monitor Dell U2311H(Digital): 1280 x 800 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 51 on monitor Dell U2311H(Digital): 1360 x 768 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 52 on monitor Dell U2311H(Digital): 1366 x 768 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 53 on monitor Dell U2311H(Digital): 1280 x 960 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 54 on monitor Dell U2311H(Digital): 1280 x 960 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 55 on monitor Dell U2311H(Digital): 1280 x 1024 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 56 on monitor Dell U2311H(Digital): 1280 x 1024 x 24 (8 8 8) 75 Hz
Closing window
Testing mode 57 on monitor Dell U2311H(Digital): 1600 x 900 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 58 on monitor Dell U2311H(Digital): 1600 x 1024 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 59 on monitor Dell U2311H(Digital): 1680 x 1050 x 24 (8 8 8) 60 Hz
Closing window
Testing mode 60 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 29 Hz
Closing window
Testing mode 61 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 30 Hz
Closing window
Testing mode 62 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 59 Hz
Closing window
Testing mode 63 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 60 Hz
Closing window

So now it somewhat “works”, but “hangs” on those modes with “Framebuffer resized to 0x0” (but it can make progress if you switch to Task Manager, for example).

PS. It is strange, but on subsequent execution it (variant with zeroing dm) managed to complete all mode switches without any errors and hangups… Well, it seems that it might be beneficial to follow an old rule “clear with zeroes all Win API structures before use”.

elmindreda wrote on Sunday, June 09, 2013:

I added a call to ZeroMemory. See if this works any better.

vittoriolassini wrote on Sunday, June 09, 2013:

I’ve done several test runs for code with ZeroMemory() and not encountered any failures.

Typical output (pardon for the long posts):

Testing mode 0 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 59 Hz
Window created in 8.941695 seconds
Framebuffer resized to 640x480
Closing window
Testing mode 1 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 60 Hz
Window created in 1.780280 seconds
Closing window
Testing mode 2 on monitor Dell U2311H(Digital): 640 x 480 x 16 (5 6 5) 75 Hz
Window created in 1.759581 seconds
Closing window
Testing mode 3 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 60 Hz
Window created in 8.452645 seconds
Closing window
Testing mode 4 on monitor Dell U2311H(Digital): 720 x 480 x 16 (5 6 5) 75 Hz
Window created in 2.105591 seconds
Closing window
Testing mode 5 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 60 Hz
Window created in 8.761601 seconds
Closing window
Testing mode 6 on monitor Dell U2311H(Digital): 720 x 576 x 16 (5 6 5) 75 Hz
Window created in 1.489508 seconds
Closing window
Testing mode 7 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 60 Hz
Window created in 8.466267 seconds
Closing window
Testing mode 8 on monitor Dell U2311H(Digital): 800 x 600 x 16 (5 6 5) 75 Hz
Window created in 1.726613 seconds
Closing window
Testing mode 9 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 60 Hz
Window created in 8.501148 seconds
Closing window
Testing mode 10 on monitor Dell U2311H(Digital): 1024 x 768 x 16 (5 6 5) 75 Hz
Window created in 1.846767 seconds
Closing window
Testing mode 11 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 59 Hz
Window created in 8.781543 seconds
Closing window
Testing mode 12 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 60 Hz
Window created in 1.802945 seconds
Closing window
Testing mode 13 on monitor Dell U2311H(Digital): 1280 x 720 x 16 (5 6 5) 75 Hz
Window created in 1.492557 seconds
Closing window
Testing mode 14 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 60 Hz
Window created in 8.814376 seconds
Closing window
Testing mode 15 on monitor Dell U2311H(Digital): 1280 x 768 x 16 (5 6 5) 75 Hz
Window created in 1.801272 seconds
Closing window
Testing mode 16 on monitor Dell U2311H(Digital): 1152 x 864 x 16 (5 6 5) 75 Hz
Window created in 8.874282 seconds
Closing window
Testing mode 17 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 60 Hz
Window created in 8.493169 seconds
Closing window
Testing mode 18 on monitor Dell U2311H(Digital): 1280 x 800 x 16 (5 6 5) 75 Hz
Window created in 1.812274 seconds
Closing window
Testing mode 19 on monitor Dell U2311H(Digital): 1360 x 768 x 16 (5 6 5) 60 Hz
Window created in 8.856451 seconds
Closing window
Testing mode 20 on monitor Dell U2311H(Digital): 1366 x 768 x 16 (5 6 5) 60 Hz
Window created in 8.583393 seconds
Closing window
Testing mode 21 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 60 Hz
Window created in 8.815638 seconds
Closing window
Testing mode 22 on monitor Dell U2311H(Digital): 1280 x 960 x 16 (5 6 5) 75 Hz
Window created in 1.830425 seconds
Closing window
Testing mode 23 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 60 Hz
Window created in 8.796940 seconds
Closing window
Testing mode 24 on monitor Dell U2311H(Digital): 1280 x 1024 x 16 (5 6 5) 75 Hz
Window created in 1.813207 seconds
Closing window
Testing mode 25 on monitor Dell U2311H(Digital): 1600 x 900 x 16 (5 6 5) 60 Hz
Window created in 9.060448 seconds
Closing window
Testing mode 26 on monitor Dell U2311H(Digital): 1600 x 1024 x 16 (5 6 5) 60 Hz
Window created in 8.917430 seconds
Closing window
Testing mode 27 on monitor Dell U2311H(Digital): 1680 x 1050 x 16 (5 6 5) 60 Hz
Window created in 8.597646 seconds
Framebuffer resized to 1680x1050
Closing window
Testing mode 28 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 29 Hz
Window created in 8.915265 seconds
Closing window
Testing mode 29 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 30 Hz
Window created in 1.867709 seconds
Closing window
Testing mode 30 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 59 Hz
Window created in 44.998088 seconds
Closing window
Testing mode 31 on monitor Dell U2311H(Digital): 1920 x 1080 x 16 (5 6 5) 60 Hz
Window created in 1.502623 seconds
Closing window
Testing mode 32 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 59 Hz
Window created in 0.710944 seconds
Closing window
Testing mode 33 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 60 Hz
Window created in 0.553520 seconds
Closing window
Testing mode 34 on monitor Dell U2311H(Digital): 640 x 480 x 24 (8 8 8) 75 Hz
Window created in 0.607437 seconds
Closing window
Testing mode 35 on monitor Dell U2311H(Digital): 720 x 480 x 24 (8 8 8) 60 Hz
Window created in 0.565247 seconds
Closing window
Testing mode 36 on monitor Dell U2311H(Digital): 720 x 480 x 24 (8 8 8) 75 Hz
Window created in 0.591837 seconds
Closing window
Testing mode 37 on monitor Dell U2311H(Digital): 720 x 576 x 24 (8 8 8) 60 Hz
Window created in 0.624000 seconds
Closing window
Testing mode 38 on monitor Dell U2311H(Digital): 720 x 576 x 24 (8 8 8) 75 Hz
Window created in 0.580804 seconds
Closing window
Testing mode 39 on monitor Dell U2311H(Digital): 800 x 600 x 24 (8 8 8) 60 Hz
Window created in 0.549600 seconds
Closing window
Testing mode 40 on monitor Dell U2311H(Digital): 800 x 600 x 24 (8 8 8) 75 Hz
Window created in 0.642323 seconds
Closing window
Testing mode 41 on monitor Dell U2311H(Digital): 1024 x 768 x 24 (8 8 8) 60 Hz
Window created in 0.542272 seconds
Closing window
Testing mode 42 on monitor Dell U2311H(Digital): 1024 x 768 x 24 (8 8 8) 75 Hz
Window created in 0.561565 seconds
Closing window
Testing mode 43 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 59 Hz
Window created in 0.585708 seconds
Closing window
Testing mode 44 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 60 Hz
Window created in 0.631264 seconds
Closing window
Testing mode 45 on monitor Dell U2311H(Digital): 1280 x 720 x 24 (8 8 8) 75 Hz
Window created in 0.583413 seconds
Closing window
Testing mode 46 on monitor Dell U2311H(Digital): 1280 x 768 x 24 (8 8 8) 60 Hz
Window created in 0.582397 seconds
Closing window
Testing mode 47 on monitor Dell U2311H(Digital): 1280 x 768 x 24 (8 8 8) 75 Hz
Window created in 0.633676 seconds
Closing window
Testing mode 48 on monitor Dell U2311H(Digital): 1152 x 864 x 24 (8 8 8) 75 Hz
Window created in 0.556546 seconds
Closing window
Testing mode 49 on monitor Dell U2311H(Digital): 1280 x 800 x 24 (8 8 8) 60 Hz
Window created in 0.581536 seconds
Closing window
Testing mode 50 on monitor Dell U2311H(Digital): 1280 x 800 x 24 (8 8 8) 75 Hz
Window created in 0.597579 seconds
Closing window
Testing mode 51 on monitor Dell U2311H(Digital): 1360 x 768 x 24 (8 8 8) 60 Hz
Window created in 0.657679 seconds
Closing window
Testing mode 52 on monitor Dell U2311H(Digital): 1366 x 768 x 24 (8 8 8) 60 Hz
Window created in 0.755425 seconds
Closing window
Testing mode 53 on monitor Dell U2311H(Digital): 1280 x 960 x 24 (8 8 8) 60 Hz
Window created in 0.577735 seconds
Closing window
Testing mode 54 on monitor Dell U2311H(Digital): 1280 x 960 x 24 (8 8 8) 75 Hz
Window created in 0.641344 seconds
Closing window
Testing mode 55 on monitor Dell U2311H(Digital): 1280 x 1024 x 24 (8 8 8) 60 Hz
Window created in 0.626542 seconds
Closing window
Testing mode 56 on monitor Dell U2311H(Digital): 1280 x 1024 x 24 (8 8 8) 75 Hz
Window created in 0.634936 seconds
Closing window
Testing mode 57 on monitor Dell U2311H(Digital): 1600 x 900 x 24 (8 8 8) 60 Hz
Window created in 0.760710 seconds
Closing window
Testing mode 58 on monitor Dell U2311H(Digital): 1600 x 1024 x 24 (8 8 8) 60 Hz
Window created in 0.648505 seconds
Closing window
Testing mode 59 on monitor Dell U2311H(Digital): 1680 x 1050 x 24 (8 8 8) 60 Hz
Window created in 0.769509 seconds
Closing window
Testing mode 60 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 29 Hz
Window created in 0.299905 seconds
Closing window
Testing mode 61 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 30 Hz
Window created in 0.179456 seconds
Closing window
Testing mode 62 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 59 Hz
Window created in 0.177850 seconds
Closing window
Testing mode 63 on monitor Dell U2311H(Digital): 1920 x 1080 x 24 (8 8 8) 60 Hz
Window created in 0.141754 seconds
Closing window

I’ve added code to measure duration of glfwCreateWindow() calls and it seems that switching to some 16 bpp modes is quite slow. Oh well, it’s not like those modes are very useful for me in this day and age…

elmindreda wrote on Sunday, June 09, 2013:

Excellent. Thank you!

I’m guessing the slowness is due to the GDI having to do a lot of work to prepare each program for suddenly working in another pixel format.