From 0bf8a3f9a1690a25eaad9b6c1bcce07ac5a24fdf Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 15 Feb 2017 15:33:05 +1100 Subject: [PATCH] Don't invalidate resolutions, should address #301. (Thanks wileycat) --- OpenTK/Platform/Windows/WinDisplayDevice.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenTK/Platform/Windows/WinDisplayDevice.cs b/OpenTK/Platform/Windows/WinDisplayDevice.cs index 04d299fba..a23e14391 100644 --- a/OpenTK/Platform/Windows/WinDisplayDevice.cs +++ b/OpenTK/Platform/Windows/WinDisplayDevice.cs @@ -50,11 +50,18 @@ namespace OpenTK.Platform.Windows { availableRes.Clear(); int i = 0; while (API.EnumDisplaySettings(winDev.DeviceName, i++, monitor_mode)) { + // For example, the device \.\DISPLAYV1 returns a single resolution with bits per pixel of 0 + // We must skip these resolutions + if (monitor_mode.BitsPerPel < 0) continue; + availableRes.Add(new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency)); } + + // This device has no valid resolutions, ignore it + if (availableRes.Count == 0) continue; // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor automatically adds the DisplayDevice to the list of available devices.