From 90168b5adf53cf012595c1b04ceaa9e614da71d9 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Tue, 20 Feb 2007 03:55:30 +0000 Subject: Fixed Issue 271: wglGetPixelFormatAttribivARB() fails forcing software OpenGL New code added for support of getChosenGLCapabilities() was causing errors described in bug report. Conditionalized querying of multisample properties based on availability of WGL_ARB_multisample extension. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1141 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../sun/opengl/impl/windows/WindowsPbufferGLDrawable.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java index 4f87eaecf..9fb06c18b 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsPbufferGLDrawable.java @@ -190,6 +190,8 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { throw new GLException("pbuffer creation error: Couldn't find a suitable pixel format"); } + boolean haveMultisample = wglExt.isExtensionAvailable("WGL_ARB_multisample"); + if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); // query pixel format @@ -199,7 +201,7 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { iattributes[3] = WGLExt.WGL_ALPHA_BITS_ARB; iattributes[4] = WGLExt.WGL_DEPTH_BITS_ARB; iattributes[5] = (useFloat ? (ati ? WGLExt.WGL_PIXEL_TYPE_ARB : WGLExt.WGL_FLOAT_COMPONENTS_NV) : WGLExt.WGL_RED_BITS_ARB); - iattributes[6] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; + iattributes[6] = (haveMultisample ? WGLExt.WGL_SAMPLE_BUFFERS_ARB : WGLExt.WGL_RED_BITS_ARB); iattributes[7] = WGLExt.WGL_SAMPLES_ARB; iattributes[8] = WGLExt.WGL_DRAW_TO_PBUFFER_ARB; int[] ivalues = new int[9]; @@ -214,7 +216,9 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { System.err.print(" b: " + ivalues[2]); System.err.print(" a: " + ivalues[3]); System.err.print(" depth: " + ivalues[4]); - System.err.print(" multisample: " + ivalues[6]); + if (haveMultisample) { + System.err.print(" multisample: " + ivalues[6]); + } System.err.print(" samples: " + ivalues[7]); if (useFloat) { if (ati) { @@ -306,8 +310,8 @@ public class WindowsPbufferGLDrawable extends WindowsGLDrawable { iattributes[niattribs++] = WGLExt.WGL_ACCUM_BLUE_BITS_ARB; iattributes[niattribs++] = WGLExt.WGL_ACCUM_ALPHA_BITS_ARB; iattributes[niattribs++] = (useFloat ? (ati ? WGLExt.WGL_PIXEL_TYPE_ARB : WGLExt.WGL_FLOAT_COMPONENTS_NV) : WGLExt.WGL_RED_BITS_ARB); - iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; - iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; + iattributes[niattribs++] = (haveMultisample ? WGLExt.WGL_SAMPLE_BUFFERS_ARB : WGLExt.WGL_RED_BITS_ARB); + iattributes[niattribs++] = (haveMultisample ? WGLExt.WGL_SAMPLES_ARB : WGLExt.WGL_RED_BITS_ARB); iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_PBUFFER_ARB; int[] ivalues = new int[niattribs]; // FIXME: usually prefer to throw exceptions, but failure here is not critical -- cgit v1.2.3