diff options
author | Sven Gothel <[email protected]> | 2012-03-06 09:59:34 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-03-06 09:59:34 +0100 |
commit | 3fbcf164be214f3c36bfc062e3ef63ddcc2e1687 (patch) | |
tree | 7172ac49435fc1cce26c82809b93322d1e72df0e /src/jogl/classes/jogamp/opengl/x11 | |
parent | efa70cd39e1a2ac18c3e8660f8d57e4569b19018 (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/classes/jogamp/opengl/x11')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java | 30 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java | 11 |
2 files changed, 22 insertions, 19 deletions
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"); } |