aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/share
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2005-12-20 19:01:57 +0000
committerKevin Rushforth <[email protected]>2005-12-20 19:01:57 +0000
commitcac51fe3e2ad463dc97538a348715cbc14fd30fd (patch)
tree2961e64115f368740502f5b29562717521109f4e /src/classes/share
parentca9425e6e24cb02235257e85662774e56662cd37 (diff)
Issue 78: Rendering stops if there's an exception in the EventDispatch
Issue 204: linux-amd64 build needs support for Cg Issue 212: PureImmediate test fails to rotate git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@480 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/classes/share')
-rw-r--r--src/classes/share/javax/media/j3d/Alpha.java6
-rw-r--r--src/classes/share/javax/media/j3d/Canvas3D.java3
-rw-r--r--src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java12
-rw-r--r--src/classes/share/javax/media/j3d/GraphicsContext3D.java9
-rw-r--r--src/classes/share/javax/media/j3d/Renderer.java21
5 files changed, 45 insertions, 6 deletions
diff --git a/src/classes/share/javax/media/j3d/Alpha.java b/src/classes/share/javax/media/j3d/Alpha.java
index 0772cd6..917e5c3 100644
--- a/src/classes/share/javax/media/j3d/Alpha.java
+++ b/src/classes/share/javax/media/j3d/Alpha.java
@@ -1000,5 +1000,9 @@ public class Alpha extends NodeComponent {
a.setAlphaAtZeroDuration(getAlphaAtZeroDuration());
return a;
}
-
+
+ static {
+ VirtualUniverse.loadLibraries();
+ }
+
}
diff --git a/src/classes/share/javax/media/j3d/Canvas3D.java b/src/classes/share/javax/media/j3d/Canvas3D.java
index 6fbdcac..ca97c62 100644
--- a/src/classes/share/javax/media/j3d/Canvas3D.java
+++ b/src/classes/share/javax/media/j3d/Canvas3D.java
@@ -2454,7 +2454,7 @@ public class Canvas3D extends Canvas {
}
final void makeCtxCurrent(long ctx, long dpy, int win) {
- if (ctx != screen.renderer.currentCtx) {
+ if (ctx != screen.renderer.currentCtx || win != screen.renderer.currentWindow) {
if (!drawingSurfaceObject.isLocked()) {
drawingSurfaceObject.renderLock();
useCtx(ctx, dpy, win);
@@ -2463,6 +2463,7 @@ public class Canvas3D extends Canvas {
useCtx(ctx, dpy, win);
}
screen.renderer.currentCtx = ctx;
+ screen.renderer.currentWindow = win;
}
}
diff --git a/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java b/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java
index 646a368..9e5eaf4 100644
--- a/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java
+++ b/src/classes/share/javax/media/j3d/DrawingSurfaceObjectAWT.java
@@ -96,7 +96,14 @@ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject {
synchronized void getDrawingSurfaceObjectInfo() {
- // get native drawing surface - ds
+ // Free old DS and DSI
+ if (nativeDS != 0 && dsi != 0) {
+ freeResource(nativeAWT, nativeDS, dsi);
+ nativeDS = 0;
+ dsi = 0;
+ }
+
+ // get native drawing surface - ds
nativeDS = getDrawingSurfaceAWT(canvas, nativeAWT);
// get window id
@@ -107,8 +114,7 @@ class DrawingSurfaceObjectAWT extends DrawingSurfaceObject {
(canvas, nativeDS, dsi, display, screenID,
xineramaDisabled);
}
- }
-
+ }
}
diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
index 18e2ba8..ffceff5 100644
--- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java
+++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java
@@ -1632,6 +1632,14 @@ public class GraphicsContext3D extends Object {
// gets yanked from us during a remove.
try {
+ // Issue 78 - need to get the drawingSurface info every
+ // frame; this is necessary since the HDC (window ID)
+ // on Windows can become invalidated without our
+ // being notified!
+ if (!canvas3d.offScreen) {
+ canvas3d.drawingSurfaceObject.getDrawingSurfaceObjectInfo();
+ }
+
if (canvas3d.drawingSurfaceObject.renderLock()) {
// XXXX : Fix texture
/*
@@ -1687,6 +1695,7 @@ public class GraphicsContext3D extends Object {
canvas3d.drawingSurfaceObject.contextValidated();
canvas3d.screen.renderer.currentCtx = canvas3d.ctx;
+ canvas3d.screen.renderer.currentWindow = canvas3d.window;
initializeState();
canvas3d.ctxChanged = true;
canvas3d.canvasDirty = 0xffff;
diff --git a/src/classes/share/javax/media/j3d/Renderer.java b/src/classes/share/javax/media/j3d/Renderer.java
index e3237ae..44cf918 100644
--- a/src/classes/share/javax/media/j3d/Renderer.java
+++ b/src/classes/share/javax/media/j3d/Renderer.java
@@ -94,6 +94,11 @@ class Renderer extends J3dThread {
*/
long currentCtx = -1;
+ /**
+ * This is the id of the current rendering window
+ */
+ long currentWindow = 0;
+
// an unique bit to identify this renderer
int rendererBit = 0;
// an unique number to identify this renderer : ( rendererBit = 1 << rendererId)
@@ -422,6 +427,7 @@ class Renderer extends J3dThread {
// currentCtx change after we create a new context
GraphicsConfigTemplate3D.runMonitor(J3dThread.NOTIFY);
currentCtx = -1;
+ currentWindow = 0;
}
} else if (secondArg instanceof Integer) {
// message from TextureRetained finalize() method
@@ -673,6 +679,14 @@ class Renderer extends J3dThread {
continue;
}
+ // Issue 78 - need to get the drawingSurface info every
+ // frame; this is necessary since the HDC (window ID)
+ // on Windows can become invalidated without our
+ // being notified!
+ if (!canvas.offScreen) {
+ canvas.drawingSurfaceObject.getDrawingSurfaceObjectInfo();
+ }
+
boolean background_image_update = false;
renderBin = canvas.view.renderBin;
@@ -1461,7 +1475,7 @@ class Renderer extends J3dThread {
// This is only invoked from removeCtx()/removeAllCtxs()
// with drawingSurface already lock
final void makeCtxCurrent(long sharedCtx, long display, int window) {
- if (sharedCtx != currentCtx) {
+ if (sharedCtx != currentCtx || window != currentWindow) {
Canvas3D.useCtx(sharedCtx, display, window);
/*
if(!Canvas3D.useCtx(sharedCtx, display, window)) {
@@ -1470,6 +1484,7 @@ class Renderer extends J3dThread {
}
*/
currentCtx = sharedCtx;
+ currentWindow = window;
}
}
@@ -1510,6 +1525,7 @@ class Renderer extends J3dThread {
freeContextResources();
Canvas3D.destroyContext(display, window, sharedCtx);
currentCtx = -1;
+ currentWindow = 0;
} else {
freeResourcesInFreeList(cv);
}
@@ -1521,6 +1537,7 @@ class Renderer extends J3dThread {
cv.freeContextResources(this, freeBackground, ctx);
Canvas3D.destroyContext(display, window, ctx);
currentCtx = -1;
+ currentWindow = 0;
cv.drawingSurfaceObject.unLock();
}
}
@@ -1561,6 +1578,7 @@ class Renderer extends J3dThread {
freeContextResources();
Canvas3D.destroyContext(display, window, sharedCtx);
currentCtx = -1;
+ currentWindow = 0;
}
cv.makeCtxCurrent();
cv.freeResourcesInFreeList(cv.ctx);
@@ -1569,6 +1587,7 @@ class Renderer extends J3dThread {
cv.window,
cv.ctx);
currentCtx = -1;
+ currentWindow = 0;
cv.drawingSurfaceObject.unLock();
}
}