Add DrawToWindow and SupportOpenGL flags to GetModesARB and check whether Wgl.Arb.ChoosePixelFormat() worked correctly (to avoid undefined results).

This commit is contained in:
the_fiddler 2011-01-18 22:34:06 +00:00
parent f4a7bf2a93
commit d19244feb5

View file

@ -215,11 +215,16 @@ namespace OpenTK.Platform.Windows
{
(int)WGL_ARB_pixel_format.AccelerationArb,
(int)WGL_ARB_pixel_format.FullAccelerationArb,
(int)WGL_ARB_pixel_format.SupportOpenglArb, 1,
(int)WGL_ARB_pixel_format.DrawToWindowArb, 1,
0, 0
};
int[] num_formats = new int[1];
Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, 0, null, num_formats);
// Get the number of available formats
if (Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, 0, null, num_formats))
{
// Create an array big enough to hold all available formats and get those formats
int[] pixel = new int[num_formats[0]];
if (Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, pixel.Length, pixel, num_formats))
@ -247,6 +252,7 @@ namespace OpenTK.Platform.Windows
}
}
}
}
#endregion