summaryrefslogtreecommitdiffstats
path: root/src/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes')
-rw-r--r--src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java8
-rw-r--r--src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java58
-rw-r--r--src/classes/linux/javax/media/j3d/NativeScreenInfo.java19
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java53
-rw-r--r--src/classes/share/javax/media/j3d/ExceptionStrings.properties1
-rw-r--r--src/classes/share/javax/media/j3d/GraphicsContext3D.java6
-rw-r--r--src/classes/share/javax/media/j3d/Renderer.java16
-rw-r--r--src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java12
-rw-r--r--src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java66
-rw-r--r--src/classes/solaris/javax/media/j3d/NativeScreenInfo.java18
10 files changed, 169 insertions, 88 deletions
diff --git a/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java b/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java
index 9a4bb27..edf86c7 100644
--- a/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java
+++ b/src/classes/linux/javax/media/j3d/J3dGraphicsConfig.java
@@ -36,8 +36,10 @@ class J3dGraphicsConfig {
}
static boolean isValidConfig(GraphicsConfiguration gc) {
- // Check to see if a valid visInfo pointer has been cached.
- Object visInfoObject = Canvas3D.visInfoTable.get(gc);
- return (visInfoObject != null) && (visInfoObject instanceof Long);
+ // Check to see if a valid FBConfig pointer has been cached.
+ Object fbConfigObject = Canvas3D.fbConfigTable.get(gc);
+ return ((fbConfigObject != null) &&
+ (fbConfigObject instanceof Long));
+
}
}
diff --git a/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java
index e5b18f7..1a7869b 100644
--- a/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java
+++ b/src/classes/linux/javax/media/j3d/NativeConfigTemplate3D.java
@@ -47,14 +47,14 @@ class NativeConfigTemplate3D {
final static int NUM_ITEMS = 9;
// Native method to get an OpenGL visual id and a pointer to the
- // XVisualInfo struct itself.
+ // GLXFBConfig structure list itself.
native int chooseOglVisual(long display, int screen,
- int[] attrList, long[] visInfo);
+ int[] attrList, long[] fbConfig);
- // Native method to free an XVisualInfo struct. This is static since it
- // may need to be called to clean up the Canvas3D visInfoTable after the
+ // Native method to free an GLXFBConfig struct. This is static since it
+ // may need to be called to clean up the Canvas3D fbConfigTable after the
// NativeConfigTemplate3D has been disposed of.
- static native void freeVisual(long visInfo);
+ static native void freeFbConfig(long fbConfig);
// Native methods to return whether a particular attribute is available
native boolean isStereoAvailable(long display, int screen, int vid);
@@ -64,7 +64,7 @@ class NativeConfigTemplate3D {
/*
- * Chooses the best visual for Java 3D apps.
+ * Chooses the best FBConfig for Java 3D apps.
*/
GraphicsConfiguration
getBestConfiguration(GraphicsConfigTemplate3D template,
@@ -73,8 +73,12 @@ class NativeConfigTemplate3D {
X11GraphicsDevice gd =
(X11GraphicsDevice)((X11GraphicsConfig)gc[0]).getDevice();
- NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
+ if (!NativeScreenInfo.isGLX13()) {
+ return null;
+ }
+ NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
+
long display = nativeScreenInfo.getDisplay();
int screen = nativeScreenInfo.getScreen();
@@ -92,7 +96,7 @@ class NativeConfigTemplate3D {
if ((bounds.x != 0 || bounds.y != 0) &&
(! VirtualUniverse.mc.xineramaDisabled)) {
// Xinerama is being used. The screen needs to be set to 0 since
- // glxChooseVisual will not return a valid visual otherwise.
+ // glxChooseFBConfig will not return a valid visual otherwise.
screen = 0;
if (debug) {
System.out.println(" Non-primary Xinerama screen:");
@@ -102,7 +106,7 @@ class NativeConfigTemplate3D {
}
int[] attrList; // holds the list of attributes to be translated
- // for glxChooseVisual call
+ // for glxChooseFBConfig call
attrList = new int[NUM_ITEMS];
@@ -116,15 +120,15 @@ class NativeConfigTemplate3D {
attrList[STEREO] = template.getStereo();
attrList[ANTIALIASING] = template.getSceneAntialiasing();
- long[] visInfo = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, visInfo);
+ long[] fbConfig = new long[1];
+ int visID = chooseOglVisual(display, screen, attrList, fbConfig);
if (debug) {
System.out.println(" chooseOglVisual() returns " + visID);
- System.out.println(" pointer to XVisualInfo is " + visInfo[0]);
+ System.out.println(" pointer to GLXFBConfig is " + fbConfig[0]);
System.out.println();
}
- if (visID == 0 || visInfo[0] == 0) {
+ if (visID == 0 || fbConfig[0] == 0) {
return null; // no valid visual was found
}
@@ -139,14 +143,14 @@ class NativeConfigTemplate3D {
// TODO: This may or may not be needed for Linux
// To support disabling Solaris OpenGL Xinerama mode, we need to cache
- // the pointer to the actual XVisualInfo that glXChooseVisual()
+ // the pointer to the actual GLXFBConfig that glXChooseFBConfig()
// returns, since this is not cached with X11GraphicsConfig and there
- // are no public constructors to allow us to extend it.
- synchronized (Canvas3D.visInfoTable) {
- if (Canvas3D.visInfoTable.get(gc1) == null)
- Canvas3D.visInfoTable.put(gc1, new Long(visInfo[0]));
+ // are no public constructors to allow us to extend it.
+ synchronized (Canvas3D.fbConfigTable) {
+ if (Canvas3D.fbConfigTable.get(gc1) == null)
+ Canvas3D.fbConfigTable.put(gc1, new Long(fbConfig[0]));
else
- freeVisual(visInfo[0]);
+ freeFbConfig(fbConfig[0]);
}
return gc1;
@@ -162,6 +166,10 @@ class NativeConfigTemplate3D {
X11GraphicsDevice gd =
(X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
+ if (!NativeScreenInfo.isGLX13()) {
+ return false;
+ }
+
NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
long display = nativeScreenInfo.getDisplay();
@@ -182,13 +190,13 @@ class NativeConfigTemplate3D {
attrList[STEREO] = template.getStereo();
attrList[ANTIALIASING] = template.getSceneAntialiasing();
- long[] visInfo = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, visInfo);
+ long[] fbConfig = new long[1];
+ int visID = chooseOglVisual(display, screen, attrList, fbConfig);
- if (visID == 0 || visInfo[0] == 0)
- return false; // no valid visual was found
+ if (visID == 0 || fbConfig[0] == 0)
+ return false; // no valid visual was found
else
- return true;
+ return true;
}
@@ -232,7 +240,7 @@ class NativeConfigTemplate3D {
}
- // Return whether scene antialiasing is available.
+ // Return whether scene antialiasing is available.
boolean hasSceneAntialiasingMultiSamples(GraphicsConfiguration gc) {
X11GraphicsDevice gd =
(X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
diff --git a/src/classes/linux/javax/media/j3d/NativeScreenInfo.java b/src/classes/linux/javax/media/j3d/NativeScreenInfo.java
index 2579f1f..aac8fa6 100644
--- a/src/classes/linux/javax/media/j3d/NativeScreenInfo.java
+++ b/src/classes/linux/javax/media/j3d/NativeScreenInfo.java
@@ -24,9 +24,28 @@ import sun.awt.X11GraphicsDevice;
class NativeScreenInfo {
private int screen;
private static long display = 0;
+ private static boolean glxChecked = false;
+ private static boolean isGLX13;
private native static long openDisplay();
private native static int getDefaultScreen(long display);
+ private native static boolean queryGLX13(long display);
+
+ // Fix for issue 20.
+ // This method will return true if glx version is 1.3 or higher,
+ // else return false.
+ synchronized static boolean isGLX13() {
+ if (!glxChecked) {
+ // Open a new static display connection if one is not already opened.
+ getStaticDisplay();
+ // Query for glx1.3 support.
+ isGLX13 = queryGLX13(display);
+ glxChecked = true;
+ }
+
+ return isGLX13;
+ }
+
synchronized static long getStaticDisplay() {
if (display == 0) {
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index fc693a6..eb979e6 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -1,3 +1,4 @@
+
/*
* $RCSfile$
*
@@ -558,19 +559,20 @@ public class Canvas3D extends Canvas {
// the visual id.
int vid = 0;
- // The visInfo field is only used when running X11. It contains a pointer
- // to the native XVisualInfo structure, since in some cases the visual id
+ // Fix for issue 20.
+ // The fbConfig is only used when running X11. It contains a pointer
+ // to the native GLXFBConfig structure list, since in some cases the visual id
// alone isn't sufficient for the native OpenGL renderer (e.g., when using
// Solaris OpenGL with Xinerama mode disabled).
- long visInfo = 0;
+ long fbConfig = 0;
- // visInfoTable is a static hashtable which allows getBestConfiguration()
+ // fbConfigTable is a static hashtable which allows getBestConfiguration()
// in NativeConfigTemplate3D to map a GraphicsConfiguration to the pointer
- // to the actual XVisualInfo that glXChooseVisual() returns. The Canvas3D
+ // to the actual GLXFBConfig that glXChooseFBConfig() returns. The Canvas3D
// doesn't exist at the time getBestConfiguration() is called, and
// X11GraphicsConfig neither maintains this pointer nor provides a public
// constructor to allow Java 3D to extend it.
- static Hashtable visInfoTable = new Hashtable();
+ static Hashtable fbConfigTable = new Hashtable();
// The native graphics version and renderer information
String nativeGraphicsVersion = null;
@@ -741,7 +743,7 @@ public class Canvas3D extends Canvas {
static final int STENCIL_BUFFER = 0x1000;
// The following three variables are set by
- // createContext()/createQueryContext() callback
+ // createNewContext()/createQueryContext() callback
// Supported Extensions
int extensionsSupported = 0;
@@ -800,16 +802,19 @@ public class Canvas3D extends Canvas {
/* native int getTextureColorTableSize(long ctx); */
// This is the native method for creating the underlying graphics context.
- native long createContext(long display, int window, int vid, long visInfo,
- long shareCtx, boolean isSharedCtx,
- boolean offScreen);
+ native long createNewContext(long display, int window, int vid, long fbConfig,
+ long shareCtx, boolean isSharedCtx,
+ boolean offScreen);
+
+ native void createQueryContext(long display, int window, int vid, long fbConfig,
+ boolean offScreen, int width, int height);
- native void createQueryContext(long display, int window, int vid, boolean offScreen, int width, int height);
native static void destroyContext(long display, int window, long context);
// This is the native for creating offscreen buffer
- native int createOffScreenBuffer(long ctx, long display, int vid, int width, int height);
- native void destroyOffScreenBuffer(long ctx, long display, int window);
+ native int createOffScreenBuffer(long ctx, long display, int window, long fbConfig, int width, int height);
+
+ native void destroyOffScreenBuffer(long ctx, long display, long fbConfig, int window);
// This is the native for reading the image from the offscreen buffer
native void readOffScreenBuffer(long ctx, int format, int width, int height);
@@ -1112,13 +1117,25 @@ public class Canvas3D extends Canvas {
this.offScreen = offScreen;
this.graphicsConfiguration = graphicsConfiguration;
- Object visInfoObject;
+ // Needed for Win32 only.
vid = nativeWSobj.getCanvasVid(graphicsConfiguration);
- visInfoObject = visInfoTable.get(graphicsConfiguration);
- if ((visInfoObject != null) && (visInfoObject instanceof Long)) {
- visInfo = ((Long)visInfoObject).longValue();
+ // Fix for issue 20.
+ // Needed for Linux and Solaris.
+ Object fbConfigObject;
+ fbConfigObject = fbConfigTable.get(graphicsConfiguration);
+ if ((fbConfigObject != null) &&
+ (fbConfigObject instanceof Long)) {
+ fbConfig = ((Long)fbConfigObject).longValue();
+ // System.out.println("Canvas3D creation FBConfig = " + fbConfig);
+
+ if (fbConfig == 0) {
+ throw new IllegalArgumentException
+ (J3dI18N.getString("Canvas3D23"));
+ }
}
+
+
if (offScreen) {
screen = new Screen3D(graphicsConfiguration, offScreen);
@@ -3371,7 +3388,7 @@ public class Canvas3D extends Canvas {
// inside the native code after setting the various
// fields in this object
createQueryContext(screen.display, window, vid,
- offScreen, 10, 10);
+ fbConfig, offScreen, 10, 10);
}
/**
diff --git a/src/classes/share/javax/media/j3d/ExceptionStrings.properties b/src/classes/share/javax/media/j3d/ExceptionStrings.properties
index a556194..9e8b25b 100644
--- a/src/classes/share/javax/media/j3d/ExceptionStrings.properties
+++ b/src/classes/share/javax/media/j3d/ExceptionStrings.properties
@@ -137,6 +137,7 @@ Canvas3D19=Canvas3D: null GraphicsConfiguration
Canvas3D20=Canvas3D does not support serialization
Canvas3D21=*** ERROR: GraphicsConfiguration not created with GraphicsConfigTemplate3D
Canvas3D22=*** This will cause an IllegalArgumentException in a subsequent release
+Canvas3D23=Unable to get FBConfig from GraphicsConfiguration
BoundingPolytope0=BoundingPolytope( Bounds) unrecognized bounds object
BoundingPolytope1=BoundingPolytope( Bounds) unrecognized bounds type
BoundingPolytope2=set( Bounds) unrecognized bounds type
diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
index 22d5fc0..e56d0ce 100644
--- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java
+++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
@@ -1580,7 +1580,7 @@ public class GraphicsContext3D extends Object {
if (canvas3d.useSharedCtx) {
if (canvas3d.screen.renderer.sharedCtx == 0) {
synchronized (VirtualUniverse.mc.contextCreationLock) {
- canvas3d.screen.renderer.sharedCtx = canvas3d.createContext(
+ canvas3d.screen.renderer.sharedCtx = canvas3d.createNewContext(
canvas3d.screen.display,
canvas3d.window, canvas3d.vid, 0, true,
canvas3d.offScreen);
@@ -1595,10 +1595,10 @@ public class GraphicsContext3D extends Object {
if (canvas3d.ctx == 0) {
synchronized (VirtualUniverse.mc.contextCreationLock) {
canvas3d.ctx =
- canvas3d.createContext(canvas3d.screen.display,
+ canvas3d.createNewContext(canvas3d.screen.display,
canvas3d.window,
canvas3d.vid,
- canvas3d.visInfo,
+ canvas3d.fbConfig,
0, false,
canvas3d.offScreen);
if (canvas3d.ctx == 0) {
diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java
index 3659f20..12b4dce 100644
--- a/src/classes/share/javax/media/j3d/Renderer.java
+++ b/src/classes/share/javax/media/j3d/Renderer.java
@@ -444,10 +444,14 @@ class Renderer extends J3dThread {
if (renderType == J3dMessage.CREATE_OFFSCREENBUFFER) {
// Fix for issue 18.
+ // Fix for issue 20.
+ /* System.out.println("Renderer offScreenBuffer - fbConfig = "
+ + canvas.fbConfig); */
canvas.window =
canvas.createOffScreenBuffer(canvas.ctx,
canvas.screen.display,
- canvas.vid,
+ canvas.window,
+ canvas.fbConfig,
canvas.offScreenCanvasSize.width,
canvas.offScreenCanvasSize.height);
m[nmesg++].decRefcount();
@@ -665,10 +669,10 @@ class Renderer extends J3dThread {
synchronized (VirtualUniverse.mc.contextCreationLock) {
sharedCtx =
- canvas.createContext(canvas.screen.display,
+ canvas.createNewContext(canvas.screen.display,
canvas.window,
canvas.vid,
- canvas.visInfo,
+ canvas.fbConfig,
0, true,
canvas.offScreen);
if (sharedCtx == 0) {
@@ -704,9 +708,9 @@ class Renderer extends J3dThread {
synchronized (VirtualUniverse.mc.contextCreationLock) {
canvas.ctx =
- canvas.createContext(canvas.screen.display,
+ canvas.createNewContext(canvas.screen.display,
canvas.window, canvas.vid,
- canvas.visInfo, sharedCtx,
+ canvas.fbConfig, sharedCtx,
false, canvas.offScreen);
@@ -1486,7 +1490,7 @@ class Renderer extends J3dThread {
// we can safely execute destroyOffScreenBuffer.
if(destroyOffScreenBuffer) {
cv.makeCtxCurrent();
- cv.destroyOffScreenBuffer(ctx, display, window);
+ cv.destroyOffScreenBuffer(ctx, display, cv.fbConfig, window);
}
if (ctx != 0) {
int idx = listOfCtxs.indexOf(new Long(ctx));
diff --git a/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java b/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java
index f64843c..218bee8 100644
--- a/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java
+++ b/src/classes/solaris/javax/media/j3d/J3dGraphicsConfig.java
@@ -29,9 +29,13 @@ class J3dGraphicsConfig {
((X11GraphicsConfig) gc).getVisual());
}
- static boolean isValidConfig(GraphicsConfiguration gc) {
- // Check to see if a valid visInfo pointer has been cached.
- Object visInfoObject = Canvas3D.visInfoTable.get(gc);
- return (visInfoObject != null) && (visInfoObject instanceof Long);
+ static boolean isValidConfig(GraphicsConfiguration gc) {
+ // Check to see if a valid fbConfig pointer has been cached.
+ Object fbConfigObject = Canvas3D.fbConfigTable.get(gc);
+ return ((fbConfigObject != null) &&
+ (fbConfigObject instanceof Long));
+
}
+
+
}
diff --git a/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java b/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java
index b41266d..80d0dd9 100644
--- a/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java
+++ b/src/classes/solaris/javax/media/j3d/NativeConfigTemplate3D.java
@@ -26,7 +26,7 @@ class NativeConfigTemplate3D {
VirtualUniverse.createMC();
}
- // These definitions should match those in win32 NativeConfigTemplate3D.java
+ // These definitions should match those in win32 NativeConfigTemplate3D.java
final static int RED_SIZE = 0;
final static int GREEN_SIZE = 1;
final static int BLUE_SIZE = 2;
@@ -39,14 +39,14 @@ class NativeConfigTemplate3D {
final static int NUM_ITEMS = 9;
// Native method to get an OpenGL visual id and a pointer to the
- // XVisualInfo struct itself.
+ // GLXFBConfig structure list itself.
native int chooseOglVisual(long display, int screen,
- int[] attrList, long[] visInfo);
+ int[] attrList, long[] fbConfig);
- // Native method to free an XVisualInfo struct. This is static since it
- // may need to be called to clean up the Canvas3D visInfoTable after the
+ // Native method to free an GLXFBConfig struct. This is static since it
+ // may need to be called to clean up the Canvas3D fbConfigTable after the
// NativeConfigTemplate3D has been disposed of.
- static native void freeVisual(long visInfo);
+ static native void freeFbConfig(long fbConfig);
// Native methods to return whether a particular attribute is available
native boolean isStereoAvailable(long display, int screen, int vid);
@@ -55,8 +55,8 @@ class NativeConfigTemplate3D {
native boolean isSceneAntialiasingMultiSamplesAvailable(long display, int screen, int vid);
- /**
- * Chooses the best visual for Java 3D apps.
+ /*
+ * Chooses the best FBConfig for Java 3D apps.
*/
GraphicsConfiguration
getBestConfiguration(GraphicsConfigTemplate3D template,
@@ -65,6 +65,10 @@ class NativeConfigTemplate3D {
X11GraphicsDevice gd =
(X11GraphicsDevice)((X11GraphicsConfig)gc[0]).getDevice();
+ if (!NativeScreenInfo.isGLX13()) {
+ return null;
+ }
+
NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
long display = nativeScreenInfo.getDisplay();
@@ -84,7 +88,7 @@ class NativeConfigTemplate3D {
if ((bounds.x != 0 || bounds.y != 0) &&
(! VirtualUniverse.mc.xineramaDisabled)) {
// Xinerama is being used. The screen needs to be set to 0 since
- // glxChooseVisual will not return a valid visual otherwise.
+ // glxChooseFBConfig will not return a valid visual otherwise.
screen = 0;
if (debug) {
System.out.println(" Non-primary Xinerama screen:");
@@ -94,7 +98,7 @@ class NativeConfigTemplate3D {
}
int[] attrList; // holds the list of attributes to be translated
- // for glxChooseVisual call
+ // for glxChooseFBConfig call
attrList = new int[NUM_ITEMS];
@@ -108,17 +112,17 @@ class NativeConfigTemplate3D {
attrList[STEREO] = template.getStereo();
attrList[ANTIALIASING] = template.getSceneAntialiasing();
- long[] visInfo = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, visInfo);
+ long[] fbConfig = new long[1];
+ int visID = chooseOglVisual(display, screen, attrList, fbConfig);
if (debug) {
System.out.println(" chooseOglVisual() returns " + visID);
- System.out.println(" pointer to XVisualInfo is " + visInfo[0]);
+ System.out.println(" pointer to GLXFBConfig is " + fbConfig[0]);
System.out.println();
}
- if (visID == 0 || visInfo[0] == 0) {
+ if (visID == 0 || fbConfig[0] == 0) {
return null; // no valid visual was found
- }
+ }
// search list of graphics configurations for config
// with matching visualId
@@ -128,22 +132,22 @@ class NativeConfigTemplate3D {
gc1 = gc[i];
break;
}
-
+
// To support disabling Solaris OpenGL Xinerama mode, we need to cache
- // the pointer to the actual XVisualInfo that glXChooseVisual()
+ // the pointer to the actual GLXFBConfig that glXChooseFBConfig()
// returns, since this is not cached with X11GraphicsConfig and there
- // are no public constructors to allow us to extend it.
- synchronized (Canvas3D.visInfoTable) {
- if (Canvas3D.visInfoTable.get(gc1) == null)
- Canvas3D.visInfoTable.put(gc1, new Long(visInfo[0]));
+ // are no public constructors to allow us to extend it.
+ synchronized (Canvas3D.fbConfigTable) {
+ if (Canvas3D.fbConfigTable.get(gc1) == null)
+ Canvas3D.fbConfigTable.put(gc1, new Long(fbConfig[0]));
else
- freeVisual(visInfo[0]);
+ freeFbConfig(fbConfig[0]);
}
return gc1;
}
- /**
+ /*
* Determine if a given GraphicsConfiguration object can be used
* by Java 3D.
*/
@@ -153,6 +157,10 @@ class NativeConfigTemplate3D {
X11GraphicsDevice gd =
(X11GraphicsDevice)((X11GraphicsConfig)gc).getDevice();
+ if (!NativeScreenInfo.isGLX13()) {
+ return false;
+ }
+
NativeScreenInfo nativeScreenInfo = new NativeScreenInfo(gd);
long display = nativeScreenInfo.getDisplay();
@@ -173,13 +181,13 @@ class NativeConfigTemplate3D {
attrList[STEREO] = template.getStereo();
attrList[ANTIALIASING] = template.getSceneAntialiasing();
- long[] visInfo = new long[1];
- int visID = chooseOglVisual(display, screen, attrList, visInfo);
-
- if (visID == 0 || visInfo[0] == 0)
- return false; // no valid visual was found
+ long[] fbConfig = new long[1];
+ int visID = chooseOglVisual(display, screen, attrList, fbConfig);
+
+ if (visID == 0 || fbConfig[0] == 0)
+ return false; // no valid visual was found
else
- return true;
+ return true;
}
diff --git a/src/classes/solaris/javax/media/j3d/NativeScreenInfo.java b/src/classes/solaris/javax/media/j3d/NativeScreenInfo.java
index a88091b..19c8967 100644
--- a/src/classes/solaris/javax/media/j3d/NativeScreenInfo.java
+++ b/src/classes/solaris/javax/media/j3d/NativeScreenInfo.java
@@ -18,9 +18,27 @@ import sun.awt.X11GraphicsDevice;
class NativeScreenInfo {
private int screen;
private static long display = 0;
+ private static boolean glxChecked = false;
+ private static boolean isGLX13;
private native static long openDisplay();
private native static int getDefaultScreen(long display);
+ private native static boolean queryGLX13(long display);
+
+ // Fix for issue 20.
+ // This method will return true if glx version is 1.3 or higher,
+ // else return false.
+ synchronized static boolean isGLX13() {
+ if (!glxChecked) {
+ // Open a new static display connection if one is not already opened.
+ getStaticDisplay();
+ // Query for glx1.3 support.
+ isGLX13 = queryGLX13(display);
+ glxChecked = true;
+ }
+
+ return isGLX13;
+ }
synchronized static long getStaticDisplay() {
if (display == 0) {