diff options
author | Sven Gothel <[email protected]> | 2011-02-05 04:03:51 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-05 04:03:51 +0100 |
commit | e2040ada5a94b466ba95e84a497290c069d377bb (patch) | |
tree | 684a5f9e61af9f6951dfae8e12d7d45adfe36ca4 /src/jogl/classes/com/jogamp/opengl | |
parent | 5d18d6b57f7d9d92a9f568e20beb64a6d44de25a (diff) |
Fix bug #459 NV/Win7 PDF/caps selection
Scenario
- NV / Win7 driver version 266.58's
- Caps: on-scr, rgba 8/8/8/0, accum-rgba 0/0/0/0, dp/st/ms: 16/8/0, dbl, mono
The above 'wglChoosePixelFormatARB' impl returns an array of pixelformats,
where the 1st entry is not hardware accelerated!
This should be considered a bug in NV's driver, since the array should return
a list ordered from 'best' to 'worst'.
Workaround trying explicit hw acceleration 1st, then generic, then software.
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl')
2 files changed, 24 insertions, 8 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 31a559ce8..f844bad76 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -268,7 +268,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio iattributes, sharedContext, accelerationMode, null)) { if (DEBUG) { - System.err.println("wglChoosePixelFormatARB1: GLCapabilities2AttribList failed: " + GDI.GetLastError()); + System.err.println("wglChoosePixelFormatARB: GLCapabilities2AttribList failed: " + GDI.GetLastError()); Thread.dumpStack(); } return null; @@ -282,7 +282,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio pformatsTmp, 0, numFormatsTmp, 0)) { if (DEBUG) { - System.err.println("wglChoosePixelFormatARB1: wglChoosePixelFormatARB failed: " + GDI.GetLastError()); + System.err.println("wglChoosePixelFormatARB: wglChoosePixelFormatARB failed: " + GDI.GetLastError()); Thread.dumpStack(); } return null; @@ -294,8 +294,14 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio System.arraycopy(pformatsTmp, 0, pformats, 0, numFormats); } if (DEBUG) { - System.err.println("wglChoosePixelFormatARB1: NumFormats (wglChoosePixelFormatARB) accelMode 0x" + System.err.println("wglChoosePixelFormatARB: NumFormats (wglChoosePixelFormatARB) accelMode 0x" + Integer.toHexString(accelerationMode) + ": " + numFormats); + for (int i = 0; i < numFormats; i++) { + WGLGLCapabilities dbgCaps0 = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities( + sharedContext, hdc, pformats[i], + capabilities.getGLProfile(), capabilities.isOnscreen(), capabilities.isPBuffer()); + System.err.println("pixel format " + pformats[i] + " (index " + i + "): " + dbgCaps0); + } } return pformats; } @@ -342,7 +348,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio static boolean GLCapabilities2AttribList(GLCapabilitiesImmutable caps, int[] iattributes, GLContextImpl sharedCtx, - int accellerationValue, + int accelerationValue, int[] floatMode) throws GLException { boolean haveWGLChoosePixelFormatARB = sharedCtx.isExtensionAvailable(WGL_ARB_pixel_format); boolean haveWGLARBMultisample = sharedCtx.isExtensionAvailable(WGL_ARB_multisample); @@ -362,9 +368,9 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio iattributes[niattribs++] = WGLExt.WGL_SUPPORT_OPENGL_ARB; iattributes[niattribs++] = GL.GL_TRUE; - if(accellerationValue>0) { + if(accelerationValue>0) { iattributes[niattribs++] = WGLExt.WGL_ACCELERATION_ARB; - iattributes[niattribs++] = accellerationValue; + iattributes[niattribs++] = accelerationValue; } if (onscreen) { iattributes[niattribs++] = WGLExt.WGL_DRAW_TO_WINDOW_ARB; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index e543c10ef..a66d62485 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -304,9 +304,19 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat // 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice int[] iattributes = new int[2 * WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; float[] fattributes = new float[1]; + int accelerationMode = WGLExt.WGL_FULL_ACCELERATION_ARB; pformats = WindowsWGLGraphicsConfiguration.wglChoosePixelFormatARB(hdc, sharedContext, capsChosen, - iattributes, -1, fattributes); - + iattributes, accelerationMode, fattributes); + if (null == pformats) { + accelerationMode = WGLExt.WGL_GENERIC_ACCELERATION_ARB; + pformats = WindowsWGLGraphicsConfiguration.wglChoosePixelFormatARB(hdc, sharedContext, capsChosen, + iattributes, accelerationMode, fattributes); + } + if (null == pformats) { + accelerationMode = -1; // use what we are offered .. + pformats = WindowsWGLGraphicsConfiguration.wglChoosePixelFormatARB(hdc, sharedContext, capsChosen, + iattributes, accelerationMode, fattributes); + } if (null != pformats) { recommendedIndex = 0; } else { |