aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-03-20 05:07:21 +0100
committerSven Gothel <[email protected]>2011-03-20 05:07:21 +0100
commit3df74690ffd910314364566a8fd6eb2c8242f96a (patch)
treeb7ccabf4fa13f2fd077122951683b0cafd4d45a7 /src/jogl
parent85f730a91507e9d4bdeab51b97de8d395fa9eb40 (diff)
Refine WGL_PIXEL_TYPE_ARB and GLX_RENDER_TYPE:
WGL_PIXEL_TYPE_ARB: Results -> GLCapabilities - WGL_TYPE_COLORINDEX_ARB not supported - Only WGL_TYPE_RGBA_FLOAT_ARB makes pbuffer float Query: - Only use WGL_FLOAT_COMPONENT_NV if supported - Remove multiple WGL_PIXEL_TYPE_ARB entry GLX_RENDER_TYPE: Results -> GLCapabilities - GLX_COLORINDEX_BIT only not supported
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java36
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java3
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);