diff options
author | Sven Gothel <[email protected]> | 2012-03-05 22:14:09 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-05 22:14:09 +0100 |
commit | cb399dc16beeeddcd8215cd276bbaff25c6fc0ca (patch) | |
tree | e0e3df670188addf21bd486c079defb1886d0ec9 /src/jogl/classes/jogamp/opengl | |
parent | 9ea78af201414e0eb5daa62ab8b72d7204590c40 (diff) |
X11 Fix NativeVisualID regression (commit 90c46b1ef1f199ceb63e85c85e9ebeb919d49c4a) ; Using plain X11 Capabilities
In case X11GLXGraphicsConfigurationFactory and hence X11GLCapabilities (glx) is not being used,
the X11GraphicsConfigurationFactory used plain Capabilities object for the chosen caps.
The latter is not derived from NativeVisualID.
- Added X11Capabilities supporting NativeVisualID to fit our needs.
- X11Capabilities.XVisualIDComparator uses NativeVisualID.NVIDType.X11_XVisualID
- *Capabilities have better unique names in toString()
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
3 files changed, 5 insertions, 34 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index 6487dae1c..5812b3153 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -241,7 +241,7 @@ public class WGLGLCapabilities extends GLCapabilities implements NativeVisualID if(null == sink) { sink = new StringBuffer(); } - sink.append("win32 vid 0x").append(Integer.toHexString(pfdID)).append(" "); + sink.append("wgl vid 0x").append(Integer.toHexString(pfdID)).append(" "); switch (arb_pixelformat) { case -1: sink.append("gdi"); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index 9ca9c5e81..008b0d6fc 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -33,41 +33,12 @@ import jogamp.nativewindow.x11.XVisualInfo; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; -import java.util.Comparator; public class X11GLCapabilities extends GLCapabilities implements NativeVisualID { final XVisualInfo xVisualInfo; // maybe null if !onscreen final long fbcfg; final int fbcfgid; - /** Comparing xvisual id only */ - public static class XVisualIDComparator implements Comparator { - - public int compare(Object o1, Object o2) { - if ( ! ( o1 instanceof X11GLCapabilities ) ) { - Class<?> c = (null != o1) ? o1.getClass() : null ; - throw new ClassCastException("arg1 not a X11GLCapabilities object: " + c); - } - if ( ! ( o2 instanceof X11GLCapabilities ) ) { - Class<?> c = (null != o2) ? o2.getClass() : null ; - throw new ClassCastException("arg2 not a X11GLCapabilities object: " + c); - } - - final X11GLCapabilities caps1 = (X11GLCapabilities) o1; - final int id1 = caps1.getXVisualID(); - - final X11GLCapabilities caps2 = (X11GLCapabilities) o2; - final int id2 = caps2.getXVisualID(); - - if(id1 > id2) { - return 1; - } else if(id1 < id2) { - return -1; - } - return 0; - } - } - public X11GLCapabilities(XVisualInfo xVisualInfo, long fbcfg, int fbcfgid, GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; @@ -116,13 +87,11 @@ public class X11GLCapabilities extends GLCapabilities implements NativeVisualID } } - final static String na_str = "----" ; - public StringBuffer toString(StringBuffer sink) { if(null == sink) { sink = new StringBuffer(); } - sink.append("x11 vid "); + sink.append("glx vid "); if(hasXVisualInfo()) { sink.append("0x").append(Long.toHexString(xVisualInfo.getVisualid())); } else { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 5122ac5bb..b118f529f 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -50,6 +50,8 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import com.jogamp.common.nio.PointerBuffer; + +import jogamp.nativewindow.x11.X11Capabilities; import jogamp.nativewindow.x11.X11Lib; import jogamp.nativewindow.x11.XVisualInfo; import jogamp.opengl.GLGraphicsConfigurationFactory; @@ -66,7 +68,7 @@ import java.util.List; GraphicsDevice and GraphicsConfiguration abstractions. */ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory { - static X11GLCapabilities.XVisualIDComparator XVisualIDComparator = new X11GLCapabilities.XVisualIDComparator(); + static X11Capabilities.XVisualIDComparator XVisualIDComparator = new X11Capabilities.XVisualIDComparator(); static GraphicsConfigurationFactory fallbackX11GraphicsConfigurationFactory = null; static void registerFactory() { final GraphicsConfigurationFactory newFactory = new X11GLXGraphicsConfigurationFactory(); |