aboutsummaryrefslogtreecommitdiffstats
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
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
-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
-rw-r--r--src/native/ogl/build-linux-amd64.xml63
-rw-r--r--src/native/ogl/build-linux-i586.xml10
-rw-r--r--src/native/ogl/build-windows-i586-vc.xml2
8 files changed, 95 insertions, 31 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();
}
}
diff --git a/src/native/ogl/build-linux-amd64.xml b/src/native/ogl/build-linux-amd64.xml
index 6676258..2561c59 100644
--- a/src/native/ogl/build-linux-amd64.xml
+++ b/src/native/ogl/build-linux-amd64.xml
@@ -13,40 +13,62 @@
*/
-->
-<!-- Ant file for building native ogl renderer files for Linux AMD64 -->
+<!-- Ant file for building native ogl renderer files for Linux/amd64 -->
<project name="Java 3D" default="compile">
- <target name="compile">
-
- <!--
- /*
- * TODO: To compile CG, add the following the the "link" command:
- * -lCg -lCgGL -lGLU -lpthread
- */
- -->
-
- <echo message="Executing 64 bit native renderer build [${bldType}]"/>
-
+ <target name="init" depends="init-cg,init-nocg">
<!-- Create the build directories for linux -->
<mkdir dir="${build}/${platform}/${bldType}/native/ogl/objs"/>
<mkdir dir="${build}/${platform}/${bldType}/lib/amd64"/>
<property name="oglsrc" location="${src}/native/ogl"/>
+ </target>
+
+ <target name="init-cg" if="build.cg">
+ <property name="cflags.cg" value="-DCOMPILE_CG_SHADERS=1"/>
+ </target>
+
+ <target name="init-nocg" unless="build.cg">
+ <property name="cflags.cg" value=""/>
+ </target>
+
+ <target name="compile-ogl">
+ <echo message="Executing 64 bit native renderer build [${bldType}]"/>
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-m64 -march=k8 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-m64 -march=k8 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib64 -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/amd64 -ljawt -L${java.home}/lib/amd64/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
- <!-- Copy the copyright library file -->
- <copy file="${build}/${platform}/${bldType}/native/ogl/objs/libj3dcore-ogl.so"
- todir="${build}/${platform}/${bldType}/lib/amd64"/>
+ </target>
+
+ <target name="compile-ogl-cg" if="build.cg">
+ <!-- Compile the wrapper -->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
+ <arg line="-m64 -march=k8 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/>
+ </exec>
+
+ <!-- Create the wrapper library -->
+ <exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
+ <arg line="CgWrapper.o -G -z defs -L/usr/X11R6/lib64 -ldl -lCg -lCgGL -lpthread -lGL -lX11 -lXext -lm -lnsl -lc -o libj3dcore-ogl-cg.so"/>
+ </exec>
+
+ </target>
+
+ <target name="compile" depends="init,compile-ogl,compile-ogl-cg">
+
+ <!-- Copy the library file -->
+ <copy todir="${build}/${platform}/${bldType}/lib/amd64">
+ <fileset dir="${build}/${platform}/${bldType}/native/ogl/objs"
+ includes="libj3dcore-ogl*.so"
+ />
+ </copy>
</target>
@@ -55,8 +77,11 @@
<mkdir dir="${dist}/${platform}/lib/amd64"/>
<!-- Copy the library files -->
- <copy file="${build}/${platform}/opt/lib/amd64/libj3dcore-ogl.so"
- todir="${dist}/${platform}/lib/amd64"/>
+ <copy todir="${dist}/${platform}/lib/amd64">
+ <fileset dir="${build}/${platform}/opt/lib/amd64"
+ includes="libj3dcore-ogl*.so"
+ />
+ </copy>
</target>
diff --git a/src/native/ogl/build-linux-i586.xml b/src/native/ogl/build-linux-i586.xml
index 6d17b00..8198ed3 100644
--- a/src/native/ogl/build-linux-i586.xml
+++ b/src/native/ogl/build-linux-i586.xml
@@ -13,7 +13,7 @@
*/
-->
-<!-- Ant file for building native ogl renderer files for Solaris -->
+<!-- Ant file for building native ogl renderer files for Linux/x86 -->
<project name="Java 3D" default="compile">
<target name="init" depends="init-cg,init-nocg">
@@ -38,12 +38,12 @@
<!-- Compile the c source files-->
<!-- Inhibit all warning for 32 bit build. Any warning will be caught in the 64 bit build -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-w -m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
+ <arg line="-w -m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/DrawingSurfaceObjectAWT.c ${oglsrc}/Canvas3D.c ${oglsrc}/GraphicsContext3D.c ${oglsrc}/NativeWSInfo.c ${oglsrc}/NativeScreenInfo.c ${oglsrc}/NativeConfigTemplate3D.c ${oglsrc}/MasterControl.c ${oglsrc}/RasterRetained.c ${oglsrc}/GeometryArrayRetained.c ${oglsrc}/Attributes.c ${oglsrc}/CgShaderProgram.c ${oglsrc}/GLSLShaderProgram.c ${oglsrc}/Lights.c ${oglsrc}/NativeAPIInfo.c"/>
</exec>
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
+ <arg line="DrawingSurfaceObjectAWT.o Canvas3D.o GraphicsContext3D.o NativeWSInfo.o NativeScreenInfo.o NativeConfigTemplate3D.o MasterControl.o RasterRetained.o GeometryArrayRetained.o Attributes.o CgShaderProgram.o GLSLShaderProgram.o Lights.o NativeAPIInfo.o -G -z defs -L/usr/X11R6/lib -ldl -lGL -lX11 -lXext -lm -lnsl -lc -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl.so"/>
</exec>
</target>
@@ -51,12 +51,12 @@
<target name="compile-ogl-cg" if="build.cg">
<!-- Compile the wrapper -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="gcc">
- <arg line="-m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I/usr/openwin/include -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/>
+ <arg line="-m32 -mcpu=i386 -I${oglsrc} -I${java.home}/../include -I${java.home}/../include/linux -I${javahCoreTarget} ${bldFlag} -DLINUX ${cflags.cg} -c ${oglsrc}/CgWrapper.c"/>
</exec>
<!-- Create the wrapper library -->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="ld">
- <arg line="CgWrapper.o -G -z defs -L/usr/X11R6/lib -ldl -lCg -lCgGL -lpthread -lGL -lX11 -lXext -lm -lnsl -lc -R/usr/openwin/lib -L${java.home}/lib/i386 -ljawt -L${java.home}/lib/i386/server -ljvm -o libj3dcore-ogl-cg.so"/>
+ <arg line="CgWrapper.o -G -z defs -L/usr/X11R6/lib -ldl -lCg -lCgGL -lpthread -lGL -lX11 -lXext -lm -lnsl -lc -o libj3dcore-ogl-cg.so"/>
</exec>
</target>
diff --git a/src/native/ogl/build-windows-i586-vc.xml b/src/native/ogl/build-windows-i586-vc.xml
index 1977e00..15acf9f 100644
--- a/src/native/ogl/build-windows-i586-vc.xml
+++ b/src/native/ogl/build-windows-i586-vc.xml
@@ -74,7 +74,7 @@
<!-- Create the library file-->
<exec dir="${build}/${platform}/${bldType}/native/ogl/objs" executable="link">
- <arg line="-nologo -dll -subsystem:windows -pdb:none -machine:I386 -out:j3dcore-ogl-cg.dll CgWrapper.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -DELAYLOAD:jawt.dll -LIBPATH:&quot;${java.home}\..\lib&quot; jawt.lib -LIBPATH:&quot;${cg.home}\lib&quot; cg.lib cgGL.lib"/>
+ <arg line="-nologo -dll -subsystem:windows -pdb:none -machine:I386 -out:j3dcore-ogl-cg.dll CgWrapper.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib opengl32.lib delayimp.lib -LIBPATH:&quot;${cg.home}\lib&quot; cg.lib cgGL.lib"/>
</exec>
</target>