diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
4 files changed, 32 insertions, 19 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index a23c5a0bc..4b3cd0120 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -140,11 +140,16 @@ public class WGLGLCapabilities extends GLCapabilities { break; case WGLExt.WGL_PIXEL_TYPE_ARB: - // Fail softly with unknown results here - if (iresults[i] == WGLExt.WGL_TYPE_RGBA_ARB || - iresults[i] == WGLExt.WGL_TYPE_RGBA_FLOAT_ARB) { + if(iresults[i] == WGLExt.WGL_TYPE_COLORINDEX_ARB) { + return false; // color index not supported + } + + if (iresults[i] == WGLExt.WGL_TYPE_RGBA_FLOAT_ARB) { setPbufferFloatingPointBuffers(true); } + + // normal RGBA FB: WGLExt.WGL_TYPE_RGBA_ARB + // ignore unknown results here break; case WGLExt.WGL_FLOAT_COMPONENTS_NV: diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 3cbef2569..d9f9dccfe 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -319,6 +319,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { final static String GL_ARB_pbuffer = "GL_ARB_pbuffer"; final static String WGL_ARB_pixel_format = "WGL_ARB_pixel_format"; final static String WGL_ARB_multisample = "WGL_ARB_multisample"; + final static String WGL_NV_float_buffer = "WGL_NV_float_buffer"; final static String WGL_ARB_make_current_read = "WGL_ARB_make_current_read"; final static String wglMakeContextCurrent = "wglMakeContextCurrent"; diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index ae07646b3..c500135f6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -50,7 +50,6 @@ import javax.media.opengl.GLProfile; import jogamp.nativewindow.windows.GDI; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; -import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLGraphicsConfigurationUtil; public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable { @@ -187,15 +186,18 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio iattributes[niattribs++] = WGLExt.WGL_SAMPLE_BUFFERS_ARB; iattributes[niattribs++] = WGLExt.WGL_SAMPLES_ARB; } + if(sharedResource.hasARBPBuffer()) { - // pbo float buffer - iattributes[niattribs++] = WGLExt.WGL_PIXEL_TYPE_ARB; // ati - iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; // nvidia + WindowsWGLContext sharedCtx = sharedResource.getContext(); + if(null != sharedCtx && sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer)) { + // pbo float buffer + iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; // nvidia + } } return niattribs; } - + static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) { int[] in = new int[1]; int[] out = new int[1]; @@ -432,6 +434,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio boolean rect = caps.getPbufferRenderToTextureRectangle(); boolean useFloat = caps.getPbufferFloatingPointBuffers(); boolean ati = false; + boolean nvidia = false; if (pbuffer && sharedResource.hasARBPBuffer()) { // Check some invariants and set up some state if (rect && !rtt) { @@ -446,21 +449,21 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } if (useFloat) { - if (!sharedCtx.isExtensionAvailable("WGL_ATI_pixel_format_float") && - !sharedCtx.isExtensionAvailable("WGL_NV_float_buffer")) { - throw new GLException("Floating-point pbuffers not supported by this hardware"); - } - // Prefer NVidia extension over ATI - if (sharedCtx.isExtensionAvailable("WGL_NV_float_buffer")) { - ati = false; + nvidia = sharedCtx.isExtensionAvailable(WindowsWGLDrawableFactory.WGL_NV_float_buffer); + if(nvidia) { floatMode[0] = GLPbuffer.NV_FLOAT; } else { - ati = true; - floatMode[0] = GLPbuffer.ATI_FLOAT; + ati = sharedCtx.isExtensionAvailable("WGL_ATI_pixel_format_float"); + if(ati) { + floatMode[0] = GLPbuffer.ATI_FLOAT; + } else { + throw new GLException("Floating-point pbuffers not supported by this hardware"); + } } + if (DEBUG) { - System.err.println("Using " + (ati ? "ATI" : "NVidia") + " floating-point extension"); + System.err.println("Using " + (ati ? "ATI" : ( nvidia ? "NVidia" : "NONE" ) ) + " floating-point extension"); } } @@ -483,7 +486,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio } } - if (useFloat && !ati) { + if (useFloat && nvidia) { iattributes[niattribs++] = WGLExt.WGL_FLOAT_COMPONENTS_NV; iattributes[niattribs++] = GL.GL_TRUE; } @@ -491,6 +494,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio if (rtt) { if (useFloat) { assert(!ati); + assert(nvidia); if (!rect) { throw new GLException("Render-to-floating-point-texture only supported on NVidia hardware with render-to-texture-rectangle"); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index c3d4563ea..109311123 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -271,6 +271,9 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp, 0)) { return false; } + if( 0 == ( GLX.GLX_RGBA_BIT & tmp[0] ) ) { + return false; // no RGBA -> color index not supported + } GLCapabilities res = new X11GLCapabilities(visualInfo, fbcfg, fbcfgid, glp); res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0); |