aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-06 09:59:34 +0100
committerSven Gothel <[email protected]>2012-03-06 09:59:34 +0100
commit3fbcf164be214f3c36bfc062e3ef63ddcc2e1687 (patch)
tree7172ac49435fc1cce26c82809b93322d1e72df0e /src/jogl
parentefa70cd39e1a2ac18c3e8660f8d57e4569b19018 (diff)
NativeWindow public* reorg 3/3 ; NativeVisualID -> VisualIDHolder incl. proper utilization.
- VisualIDHolder: Update documentation (Exception case, etc) - NativeVisualID -> VisualIDHolder (public) - incl. generic Comparator - better doc and enum values - VID_UNDEFINED == 0 - methods shall not throw exception, but return UNDEFINED - CapabilitiesImmutable extends VisualIDHolder - All Capabilties impl. - use VID_UNDEFINED for undef. value - use final private (immutable) fields - AbstractGraphicsConfiguration extends VisualIDHolder - X11 CreateDummyWindow takes (int) visualID
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java17
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java51
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java32
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java53
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java11
8 files changed, 82 insertions, 132 deletions
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index 32055c5e0..b54089d13 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -36,15 +36,15 @@
package jogamp.opengl.egl;
-import jogamp.nativewindow.NativeVisualID;
-import jogamp.nativewindow.NativeVisualID.NVIDType;
import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.GLDrawableImpl;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.*;
+import javax.media.nativewindow.VisualIDHolder.VIDType;
import javax.media.opengl.*;
+import com.jogamp.nativewindow.egl.*;
+
public abstract class EGLDrawable extends GLDrawableImpl {
protected boolean ownEGLDisplay = false; // for destruction
protected boolean ownEGLSurface = false; // for destruction
@@ -181,17 +181,8 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println(getThreadName() + ": Reusing chosenCaps: "+eglConfig);
}
} else {
- final int nativeVisualID;
- {
- final GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) aConfig.getChosenCapabilities();
- if(capsChosen instanceof NativeVisualID) {
- nativeVisualID = ((NativeVisualID)capsChosen).getVisualID(NVIDType.NATIVE_ID);
- } else {
- nativeVisualID = -1;
- }
- }
eglConfig = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
- capsRequested, capsRequested, null, s, nativeVisualID);
+ capsRequested, capsRequested, null, s, aConfig.getVisualID(VIDType.NATIVE));
if (null == eglConfig) {
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+s);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 53043c3cc..14cf83f56 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -37,15 +37,15 @@
package jogamp.opengl.egl;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.egl.EGLGraphicsDevice;
import javax.media.opengl.*;
import javax.media.opengl.GLProfile.ShutdownType;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
+import com.jogamp.nativewindow.WrappedSurface;
+import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import jogamp.opengl.*;
-import jogamp.nativewindow.WrappedSurface;
import java.util.Collection;
import java.util.HashMap;
@@ -358,7 +358,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
// FIXME device/windowHandle -> screen ?!
EGLGraphicsDevice device = (EGLGraphicsDevice) adevice;
DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
- EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, -1);
+ EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED);
WrappedSurface ns = new WrappedSurface(cfg, windowHandle);
return ns;
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index cc7d267b0..2e1793d72 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -28,46 +28,30 @@
package jogamp.opengl.egl;
-import java.util.Comparator;
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.VisualIDHolder;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-import jogamp.nativewindow.NativeVisualID;
-public class EGLGLCapabilities extends GLCapabilities implements NativeVisualID {
- final long eglcfg;
- final int eglcfgid;
- final int renderableType;
- int nativeVisualID;
+public class EGLGLCapabilities extends GLCapabilities {
+ final private long eglcfg;
+ final private int eglcfgid;
+ final private int renderableType;
+ final private int nativeVisualID;
- /** Comparing EGLConfig ID only */
- public static class EglCfgIDComparator implements Comparator<EGLGLCapabilities> {
-
- public int compare(EGLGLCapabilities caps1, EGLGLCapabilities caps2) {
- final long id1 = caps1.getEGLConfigID();
-
- final long id2 = caps2.getEGLConfigID();
-
- if(id1 > id2) {
- return 1;
- } else if(id1 < id2) {
- return -1;
- }
- return 0;
- }
- }
-
/**
*
* @param eglcfg
* @param eglcfgid
+ * @param visualID native visualID if valid, otherwise VisualIDHolder.VID_UNDEFINED
* @param glp desired GLProfile, or null if determined by renderableType
* @param renderableType actual EGL renderableType
*
* May throw GLException if given GLProfile is not compatible w/ renderableType
*/
- public EGLGLCapabilities(long eglcfg, int eglcfgid, GLProfile glp, int renderableType) {
+ public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) {
super( ( null != glp ) ? glp : getCompatible(renderableType) );
this.eglcfg = eglcfg;
this.eglcfgid = eglcfgid;
@@ -76,7 +60,7 @@ public class EGLGLCapabilities extends GLCapabilities implements NativeVisualID
" with EGL-RenderableType["+renderableTypeToString(null, renderableType)+"]");
}
this.renderableType = renderableType;
- this.nativeVisualID = -1;
+ this.nativeVisualID = visualID;
}
public Object cloneMutable() {
@@ -94,21 +78,18 @@ public class EGLGLCapabilities extends GLCapabilities implements NativeVisualID
final public long getEGLConfig() { return eglcfg; }
final public int getEGLConfigID() { return eglcfgid; }
final public int getRenderableType() { return renderableType; }
- final public void setNativeVisualID(int vid) { nativeVisualID=vid; }
final public int getNativeVisualID() { return nativeVisualID; }
- final public int getVisualID(NVIDType type) {
+ @Override
+ final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
- case GEN_ID:
- // fall through intended
- case EGL_ConfigID:
+ case INTRINSIC:
+ case EGL_CONFIG:
return getEGLConfigID();
- case NATIVE_ID:
- // fall through intended
- case EGL_NativeVisualID:
+ case NATIVE:
return getNativeVisualID();
default:
- throw new IllegalArgumentException("Invalid type <"+type+">");
+ throw new NativeWindowException("Invalid type <"+type+">");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 70f62e3e6..35e30c5f4 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -42,6 +42,7 @@ import java.util.ArrayList;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.VisualIDHolder;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -170,6 +171,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
final IntBuffer val = Buffers.newDirectIntBuffer(1);
final int cfgID;
final int rType;
+ final int visualID;
// get the configID
if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
@@ -188,10 +190,16 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return false;
}
rType = val.get(0);
+
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_NATIVE_VISUAL_ID, val)) {
+ visualID = val.get(0);
+ } else {
+ visualID = VisualIDHolder.VID_UNDEFINED;
+ }
EGLGLCapabilities caps = null;
try {
- caps = new EGLGLCapabilities(config, cfgID, glp, rType);
+ caps = new EGLGLCapabilities(config, cfgID, visualID, glp, rType);
} catch (GLException gle) {
if(DEBUG) {
System.err.println("config "+toHexString(config)+": "+gle);
@@ -199,10 +207,6 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return false;
}
- // Read the actual configuration into the chosen caps
- if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_NATIVE_VISUAL_ID, val)) {
- caps.setNativeVisualID(val.get(0));
- }
if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val)) {
caps.setRedBits(val.get(0));
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index 831dceac2..2d9fc0227 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -40,8 +40,9 @@ import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.DefaultGraphicsScreen;
import javax.media.nativewindow.GraphicsConfigurationFactory;
+import javax.media.nativewindow.VisualIDHolder;
+import javax.media.nativewindow.VisualIDHolder.VIDType;
import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.egl.EGLGraphicsDevice;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesChooser;
@@ -52,9 +53,8 @@ import javax.media.opengl.GLDrawableFactory;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
-import jogamp.nativewindow.NativeVisualID;
-import jogamp.nativewindow.NativeVisualID.NVIDType;
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
@@ -71,7 +71,7 @@ import java.nio.IntBuffer;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
- static EGLGLCapabilities.EglCfgIDComparator EglCfgIDComparator = new EGLGLCapabilities.EglCfgIDComparator();
+ static VisualIDHolder.VIDComparator EglCfgIDComparator = new VisualIDHolder.VIDComparator(VisualIDHolder.VIDType.EGL_CONFIG);
static GraphicsConfigurationFactory nativeGraphicsConfigurationFactory = null;
static void registerFactory() {
@@ -80,14 +80,14 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
// become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected
final String nwType = NativeWindowFactory.getNativeWindowType(false);
if(NativeWindowFactory.TYPE_X11 == nwType) {
- nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, eglFactory);
+ nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, eglFactory);
} /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) {
nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory);
} else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
} */
// become the selector for KD/EGL ..
- GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.egl.EGLGraphicsDevice.class, eglFactory);
+ GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, eglFactory);
}
private EGLGraphicsConfigurationFactory() {
@@ -125,7 +125,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
cfg = chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen,
(GLCapabilitiesImmutable) capsRequested,
(GLCapabilitiesChooser) chooser,
- absScreen, -1);
+ absScreen, VisualIDHolder.VID_UNDEFINED);
} else {
// handle non native cases (X11, ..)
if(null == nativeGraphicsConfigurationFactory) {
@@ -139,8 +139,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
cfg = chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen,
(GLCapabilitiesImmutable) capsRequested,
(GLCapabilitiesChooser) chooser,
- absScreen, -1);
- if(null == cfg || 0>=((NativeVisualID)cfg.getChosenCapabilities()).getVisualID(NVIDType.NATIVE_ID)) {
+ absScreen, VisualIDHolder.VID_UNDEFINED);
+ if(null == cfg || VisualIDHolder.VID_UNDEFINED == cfg.getVisualID(VIDType.NATIVE)) {
cfg = null;
if(DEBUG) {
System.err.println("EGLGraphicsConfigurationFactory.choose..: No native visual ID, fallback ..");
@@ -321,7 +321,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
// 1st choice: get GLCapabilities based on users GLCapabilities
// setting recommendedIndex as preferred choice
// skipped if nativeVisualID is given
- if( 0<=nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
+ if( VisualIDHolder.VID_UNDEFINED != nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
if(DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: #1 eglChooseConfig: false");
}
@@ -370,11 +370,11 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
}
- if(0<=nativeVisualID) {
+ if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) {
List/*<EGLGLCapabilities>*/ removedCaps = new ArrayList();
for(int i=0; i<availableCaps.size(); ) {
- EGLGLCapabilities ecap = (EGLGLCapabilities) availableCaps.get(i);
- if(ecap.getNativeVisualID()!=nativeVisualID) {
+ VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
+ if(vidh.getVisualID(VIDType.NATIVE) != nativeVisualID) {
removedCaps.add(availableCaps.remove(i));
} else {
i++;
@@ -383,10 +383,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(0==availableCaps.size()) {
availableCaps = removedCaps;
if(DEBUG) {
- System.err.println("EGLGraphicsConfiguration.eglChooseConfig: post filter nativeVisualID ("+nativeVisualID+") no config found, revert to all");
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: post filter nativeVisualID "+toHexString(nativeVisualID)+" no config found, revert to all");
}
} else if(DEBUG) {
- System.err.println("EGLGraphicsConfiguration.eglChooseConfig: post filter nativeVisualID ("+nativeVisualID+") got configs: "+availableCaps.size());
+ System.err.println("EGLGraphicsConfiguration.eglChooseConfig: post filter nativeVisualID "+toHexString(nativeVisualID)+" got configs: "+availableCaps.size());
}
}
@@ -431,7 +431,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
- EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(capsChosen, capsReq, chooser, screen, -1);
+ EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(capsChosen, capsReq, chooser, screen, VisualIDHolder.VID_UNDEFINED);
if (null == eglConfig) {
throw new GLException("Couldn't create EGLGraphicsConfiguration from "+screen);
} else if(DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
index 5812b3153..24bc5aea6 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
@@ -28,48 +28,19 @@
package jogamp.opengl.windows.wgl;
-import java.util.Comparator;
-
-import jogamp.nativewindow.NativeVisualID;
import jogamp.nativewindow.windows.GDI;
import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR;
+
+import javax.media.nativewindow.NativeWindowException;
import javax.media.opengl.GL;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-public class WGLGLCapabilities extends GLCapabilities implements NativeVisualID {
- final PIXELFORMATDESCRIPTOR pfd;
- final int pfdID;
- int arb_pixelformat; // -1 PFD, 0 NOP, 1 ARB
-
- /** Comparing pfd id only */
- public static class PfdIDComparator implements Comparator {
-
- public int compare(Object o1, Object o2) {
- if ( ! ( o1 instanceof WGLGLCapabilities ) ) {
- Class c = (null != o1) ? o1.getClass() : null ;
- throw new ClassCastException("arg1 not a WGLGLCapabilities object: " + c);
- }
- if ( ! ( o2 instanceof WGLGLCapabilities ) ) {
- Class c = (null != o2) ? o2.getClass() : null ;
- throw new ClassCastException("arg2 not a WGLGLCapabilities object: " + c);
- }
-
- final WGLGLCapabilities caps1 = (WGLGLCapabilities) o1;
- final long id1 = caps1.getPFDID();
-
- final WGLGLCapabilities caps2 = (WGLGLCapabilities) o2;
- final long id2 = caps2.getPFDID();
-
- if(id1 > id2) {
- return 1;
- } else if(id1 < id2) {
- return -1;
- }
- return 0;
- }
- }
+public class WGLGLCapabilities extends GLCapabilities {
+ final private PIXELFORMATDESCRIPTOR pfd;
+ final private int pfdID;
+ private int arb_pixelformat; // -1 PFD, 0 NOP, 1 ARB
public WGLGLCapabilities(PIXELFORMATDESCRIPTOR pfd, int pfdID, GLProfile glp) {
super(glp);
@@ -225,15 +196,15 @@ public class WGLGLCapabilities extends GLCapabilities implements NativeVisualID
final public boolean isSetByGDI() { return 0 > arb_pixelformat; }
final public boolean isSet() { return 0 != arb_pixelformat; }
- final public int getVisualID(NVIDType type) {
+ @Override
+ final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
- case GEN_ID:
- case NATIVE_ID:
- // fall through intended
- case WIN32_PFDID:
+ case INTRINSIC:
+ case NATIVE:
+ case WIN32_PFD:
return getPFDID();
default:
- throw new IllegalArgumentException("Invalid type <"+type+">");
+ throw new NativeWindowException("Invalid type <"+type+">");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
index 008b0d6fc..bb0673581 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
@@ -28,16 +28,18 @@
package jogamp.opengl.x11.glx;
-import jogamp.nativewindow.NativeVisualID;
import jogamp.nativewindow.x11.XVisualInfo;
+
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.nativewindow.VisualIDHolder;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-public class X11GLCapabilities extends GLCapabilities implements NativeVisualID {
- final XVisualInfo xVisualInfo; // maybe null if !onscreen
- final long fbcfg;
- final int fbcfgid;
+public class X11GLCapabilities extends GLCapabilities {
+ final private XVisualInfo xVisualInfo; // maybe null if !onscreen
+ final private long fbcfg;
+ final private int fbcfgid;
public X11GLCapabilities(XVisualInfo xVisualInfo, long fbcfg, int fbcfgid, GLProfile glp) {
super(glp);
@@ -50,7 +52,7 @@ public class X11GLCapabilities extends GLCapabilities implements NativeVisualID
super(glp);
this.xVisualInfo = xVisualInfo;
this.fbcfg = 0;
- this.fbcfgid = -1;
+ this.fbcfgid = VisualIDHolder.VID_UNDEFINED;
}
public Object cloneMutable() {
@@ -71,19 +73,19 @@ public class X11GLCapabilities extends GLCapabilities implements NativeVisualID
final public long getFBConfig() { return fbcfg; }
final public int getFBConfigID() { return fbcfgid; }
- final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid>0; }
+ final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid!=VisualIDHolder.VID_UNDEFINED; }
- final public int getVisualID(NVIDType type) {
+ @Override
+ final public int getVisualID(VIDType type) throws NativeWindowException {
switch(type) {
- case GEN_ID:
- case NATIVE_ID:
- // fall through intended
- case X11_XVisualID:
+ case INTRINSIC:
+ case NATIVE:
+ case X11_XVISUAL:
return getXVisualID();
- case X11_FBConfigID:
+ case X11_FBCONFIG:
return getFBConfigID();
default:
- throw new IllegalArgumentException("Invalid type <"+type+">");
+ throw new NativeWindowException("Invalid type <"+type+">");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index b118f529f..22347ea5c 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -39,8 +39,7 @@ import javax.media.nativewindow.AbstractGraphicsScreen;
import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.x11.X11GraphicsScreen;
-import javax.media.nativewindow.x11.X11GraphicsDevice;
+import javax.media.nativewindow.VisualIDHolder;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesChooser;
@@ -50,8 +49,9 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.nativewindow.x11.X11GraphicsDevice;
+import com.jogamp.nativewindow.x11.X11GraphicsScreen;
-import jogamp.nativewindow.x11.X11Capabilities;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.XVisualInfo;
import jogamp.opengl.GLGraphicsConfigurationFactory;
@@ -68,11 +68,12 @@ import java.util.List;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
- static X11Capabilities.XVisualIDComparator XVisualIDComparator = new X11Capabilities.XVisualIDComparator();
+ static VisualIDHolder.VIDComparator XVisualIDComparator = new VisualIDHolder.VIDComparator(VisualIDHolder.VIDType.X11_XVISUAL);
+
static GraphicsConfigurationFactory fallbackX11GraphicsConfigurationFactory = null;
static void registerFactory() {
final GraphicsConfigurationFactory newFactory = new X11GLXGraphicsConfigurationFactory();
- final GraphicsConfigurationFactory oldFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, newFactory);
+ final GraphicsConfigurationFactory oldFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, newFactory);
if(oldFactory == newFactory) {
throw new InternalError("GraphicsConfigurationFactory lifecycle impl. error");
}