Fixed recursion that between WinGraphicsMode.SelectGraphicsModeARB and GraphicsMode.Default.

Fixed acceleration attribute in WinGraphicsMode.SelectGraphicsModeARB. Now, antialiasing works on nvidia drivers, too.
This commit is contained in:
the_fiddler 2009-06-01 13:24:18 +00:00
parent 66efa41a8f
commit b1b3706e64

View file

@ -156,7 +156,7 @@ namespace OpenTK.Platform.Windows
{ {
using (Control native_window = new Control()) using (Control native_window = new Control())
using (WinWindowInfo window = new WinWindowInfo(native_window.Handle, null)) using (WinWindowInfo window = new WinWindowInfo(native_window.Handle, null))
using (WinGLContext context = new WinGLContext(GraphicsMode.Default, window, null, 1, 0, GraphicsContextFlags.Default)) using (WinGLContext context = new WinGLContext(new GraphicsMode(new ColorFormat(), 0, 0, 0, new ColorFormat(), 2, false), window, null, 1, 0, GraphicsContextFlags.Default))
{ {
Debug.Write("Selecting pixel format (ARB)... "); Debug.Write("Selecting pixel format (ARB)... ");
if (Wgl.Delegates.wglChoosePixelFormatARB == null || Wgl.Delegates.wglGetPixelFormatAttribivARB == null) if (Wgl.Delegates.wglChoosePixelFormatARB == null || Wgl.Delegates.wglGetPixelFormatAttribivARB == null)
@ -196,7 +196,7 @@ namespace OpenTK.Platform.Windows
int[] attribs_values = new int[] int[] attribs_values = new int[]
{ {
(int)WGL_ARB_pixel_format.AccelerationArb, 1, (int)WGL_ARB_pixel_format.AccelerationArb, (int)WGL_ARB_pixel_format.FullAccelerationArb,
(int)WGL_ARB_pixel_format.RedBitsArb, color.Red, (int)WGL_ARB_pixel_format.RedBitsArb, color.Red,
(int)WGL_ARB_pixel_format.GreenBitsArb, color.Green, (int)WGL_ARB_pixel_format.GreenBitsArb, color.Green,
@ -224,6 +224,12 @@ namespace OpenTK.Platform.Windows
int[] pixel = new int[1], num_formats = new int[1]; int[] pixel = new int[1], num_formats = new int[1];
Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, 1, pixel, num_formats); Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, 1, pixel, num_formats);
if (num_formats[0] == 0 || pixel[0] == 0) if (num_formats[0] == 0 || pixel[0] == 0)
{
// Try again without an accumulator. Many modern cards cannot accelerate multisampled formats with accumulator buffers.
attribs_values[10 * 2 + 1] = attribs_values[11 * 2 + 1] = attribs_values[12 * 2 + 1] = attribs_values[13 * 2 + 1] = attribs_values[14 * 2 + 1] = 0;
Wgl.Arb.ChoosePixelFormat(window.DeviceContext, attribs_values, null, 1, pixel, num_formats);
}
if (num_formats[0] == 0 || pixel[0] == 0)
{ {
Debug.WriteLine("failed"); Debug.WriteLine("failed");
return null; return null;