aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/x11
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-05 04:34:41 +0100
committerSven Gothel <[email protected]>2012-03-05 04:34:41 +0100
commit90c46b1ef1f199ceb63e85c85e9ebeb919d49c4a (patch)
treeded4b93e80eb39ff33c80638c10a531222c105a3 /src/jogl/classes/jogamp/opengl/x11
parent875042340b68137b584907c539b7b7ecc5c5b15c (diff)
Complete LOCK_SURFACE_CHANGED ; Introduce NativeVisualID (Daisy chaining *GraphicsConfiguration) ; ...
NativeVisualID: New interface for Capabilities implementations, allowing retrieval of the native 'visual id'. Impl. by WGL, X11 and EGL. JAWTWindow.lockSurface() - Detect surfaceHandle change an return LOCK_SURFACE_CHANGED (see: LOCK_SURFACE_CHANGED) EGLDrawable: - Impl. updateHandle() (see: LOCK_SURFACE_CHANGED) - use NativeVisualID for EGLGraphicsConfiguration selection to respect a native 'visual id' EGLContext.createContextImpl: Use NIO for attributes EGLDisplayUtil: Enhance eglGetDisplay w/ DEBUG code and NativeSurface / EGL_DEFAULT_DISPLAY variation EGL, XGL, WGL GraphicsConfiguration: - Don't set ALPHA_SIZE and STENCIL_SIZE if not requested in attribute list for context creation. - toString() shows proper identification, eg.: egl, x11, win32 .. EGLGraphicsConfigurationFactory: Daisy chain GraphicsConfigurationFactory for native device type (currently only X11). This allows choosing the EGLGraphicsConfiguration and hence native visual id based on EGL when invoked via the factory model (generic). In case EGLGraphicsConfigurationFactory is not suitable or doesn't produce a native visual id, it falls back the the original one. X11AWTGraphicsConfigurationFactory and X11Window: Use generic NativeVisualID which allows EGLGraphicsConfiguration implicit. *GraphicsConfiguration's DEBUG flag is pushed up to DefaultGraphicsConfiguration LOCK_SURFACE_CHANGED: - commit 006e9fe402a0a47b45fd2c4af51296aef895e8b5 - commit a0177c8a1048683e5d43f4712f8f9e37091d4e85 Impact: - Fixes EGL/GLES (wrapper/native) usage on X11, proper Xvisual selection w/ EGL - Fixes EGL/GLES (wrapper/native) usage on Windows, ANGLE works w/ NEWT and forced ES2
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11')
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java13
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java2
3 files changed, 28 insertions, 13 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
index f4f01195f..9ca9c5e81 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
@@ -28,13 +28,14 @@
package jogamp.opengl.x11.glx;
+import jogamp.nativewindow.NativeVisualID;
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 {
+public class X11GLCapabilities extends GLCapabilities implements NativeVisualID {
final XVisualInfo xVisualInfo; // maybe null if !onscreen
final long fbcfg;
final int fbcfgid;
@@ -53,10 +54,10 @@ public class X11GLCapabilities extends GLCapabilities {
}
final X11GLCapabilities caps1 = (X11GLCapabilities) o1;
- final long id1 = caps1.getXVisualID();
+ final int id1 = caps1.getXVisualID();
final X11GLCapabilities caps2 = (X11GLCapabilities) o2;
- final long id2 = caps2.getXVisualID();
+ final int id2 = caps2.getXVisualID();
if(id1 > id2) {
return 1;
@@ -94,25 +95,40 @@ public class X11GLCapabilities extends GLCapabilities {
}
final public XVisualInfo getXVisualInfo() { return xVisualInfo; }
- final public long getXVisualID() { return (null!=xVisualInfo) ? xVisualInfo.getVisualid() : 0; }
+ final public int getXVisualID() { return (null!=xVisualInfo) ? (int) xVisualInfo.getVisualid() : 0; }
final public boolean hasXVisualInfo() { return null!=xVisualInfo; }
final public long getFBConfig() { return fbcfg; }
final public int getFBConfigID() { return fbcfgid; }
final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid>0; }
+ final public int getVisualID(NVIDType type) {
+ switch(type) {
+ case GEN_ID:
+ case NATIVE_ID:
+ // fall through intended
+ case X11_XVisualID:
+ return getXVisualID();
+ case X11_FBConfigID:
+ return getFBConfigID();
+ default:
+ throw new IllegalArgumentException("Invalid type <"+type+">");
+ }
+ }
+
final static String na_str = "----" ;
public StringBuffer toString(StringBuffer sink) {
if(null == sink) {
sink = new StringBuffer();
}
+ sink.append("x11 vid ");
if(hasXVisualInfo()) {
sink.append("0x").append(Long.toHexString(xVisualInfo.getVisualid()));
} else {
sink.append(na_str);
}
- sink.append(" ");
+ sink.append(", fbc ");
if(hasFBConfig()) {
sink.append("0x").append(Integer.toHexString(fbcfgid));
} else {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index b2d679438..f1d804b35 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -51,14 +51,11 @@ import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.XRenderDirectFormat;
import jogamp.nativewindow.x11.XRenderPictFormat;
import jogamp.nativewindow.x11.XVisualInfo;
-import jogamp.opengl.Debug;
import jogamp.opengl.GLGraphicsConfigurationUtil;
import com.jogamp.common.nio.PointerBuffer;
public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable {
- protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
-
public static final int MAX_ATTRIBS = 128;
private GLCapabilitiesChooser chooser;
@@ -176,14 +173,16 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res[idx++] = caps.getGreenBits();
res[idx++] = GLX.GLX_BLUE_SIZE;
res[idx++] = caps.getBlueBits();
- res[idx++] = GLX.GLX_ALPHA_SIZE;
- res[idx++] = caps.getAlphaBits();
- res[idx++] = GLX.GLX_DEPTH_SIZE;
- res[idx++] = caps.getDepthBits();
+ if(caps.getAlphaBits()>0) {
+ res[idx++] = GLX.GLX_ALPHA_SIZE;
+ res[idx++] = caps.getAlphaBits();
+ }
if (caps.getStencilBits() > 0) {
res[idx++] = GLX.GLX_STENCIL_SIZE;
res[idx++] = caps.getStencilBits();
}
+ res[idx++] = GLX.GLX_DEPTH_SIZE;
+ res[idx++] = caps.getDepthBits();
if (caps.getAccumRedBits() > 0 ||
caps.getAccumGreenBits() > 0 ||
caps.getAccumBlueBits() > 0 ||
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index fc7aac06d..b2a8326cb 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -75,7 +75,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
}
@Override
- protected void updateHandle() {
+ protected final void updateHandle() {
if(USE_GLXWINDOW) {
X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration();
if(config.getFBConfig()>=0) {