aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/share')
-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
4 files changed, 49 insertions, 27 deletions
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));