diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/javax/media/j3d/Canvas3D.java | 14 | ||||
-rw-r--r-- | src/javax/media/j3d/CanvasViewEventCatcher.java | 7 | ||||
-rw-r--r-- | src/javax/media/j3d/GroupRetained.java | 11 | ||||
-rw-r--r-- | src/javax/media/j3d/JoglPipeline.java | 34 | ||||
-rw-r--r-- | src/javax/media/j3d/MasterControl.java | 21 | ||||
-rw-r--r-- | src/javax/media/j3d/NodeRetained.java | 3 | ||||
-rw-r--r-- | src/javax/media/j3d/VirtualUniverse.java | 7 |
7 files changed, 59 insertions, 38 deletions
diff --git a/src/javax/media/j3d/Canvas3D.java b/src/javax/media/j3d/Canvas3D.java index 080bd18..8824191 100644 --- a/src/javax/media/j3d/Canvas3D.java +++ b/src/javax/media/j3d/Canvas3D.java @@ -32,12 +32,14 @@ import java.awt.Container; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.IllegalComponentStateException; import java.awt.Point; import java.awt.Window; +import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Hashtable; @@ -820,6 +822,8 @@ ArrayList<Integer> textureIdResourceFreeList = new ArrayList<Integer>(); // CanvasViewEventCatcher. Point newPosition = new Point(); Dimension newSize = new Dimension(); + double xscale = 1.0; + double yscale = 1.0; // Remember OGL context resources to free // before context is destroy. @@ -1227,9 +1231,15 @@ ArrayList<TextureRetained> textureIDResourceTable = new ArrayList<TextureRetaine if (!firstPaintCalled && added && validCanvas && validGraphicsMode()) { + final Graphics2D g2d = (Graphics2D) g; + final AffineTransform t = g2d.getTransform(); + try { - newSize = getSize(); - newPosition = getLocationOnScreen(); + Dimension scaledSize = getSize(); + xscale = t.getScaleX(); + yscale = t.getScaleY(); + newSize = new Dimension((int)(scaledSize.getWidth()*xscale), (int)(scaledSize.getHeight()*yscale)); + newPosition = getLocationOnScreen(); } catch (IllegalComponentStateException e) { return; } diff --git a/src/javax/media/j3d/CanvasViewEventCatcher.java b/src/javax/media/j3d/CanvasViewEventCatcher.java index aadbf5f..478a84c 100644 --- a/src/javax/media/j3d/CanvasViewEventCatcher.java +++ b/src/javax/media/j3d/CanvasViewEventCatcher.java @@ -26,6 +26,7 @@ package javax.media.j3d; +import java.awt.Dimension; import java.awt.IllegalComponentStateException; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; @@ -65,7 +66,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // see comment below try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} @@ -90,7 +92,8 @@ class CanvasViewEventCatcher extends ComponentAdapter { // first, then canvas lock in removeComponentListener() try { - canvas.newSize = canvas.getSize(); + Dimension size = canvas.getSize(); + canvas.newSize = new Dimension((int)(size.getWidth()*canvas.xscale), (int)(size.getHeight()*canvas.yscale)); canvas.newPosition = canvas.getLocationOnScreen(); } catch (IllegalComponentStateException ex) {} diff --git a/src/javax/media/j3d/GroupRetained.java b/src/javax/media/j3d/GroupRetained.java index 84a6bc6..826a989 100644 --- a/src/javax/media/j3d/GroupRetained.java +++ b/src/javax/media/j3d/GroupRetained.java @@ -2128,17 +2128,6 @@ synchronized void setAltAppScope() { (TargetsInterface)parentSwitchLink; } - - @Override - synchronized void updateLocalToVworld() { - // For each children call ..... - for (int i=children.size()-1; i>=0; i--) { - NodeRetained child = children.get(i); - if(child != null) - child.updateLocalToVworld(); - } - } - @Override void setNodeData(SetLiveState s) { super.setNodeData(s); diff --git a/src/javax/media/j3d/JoglPipeline.java b/src/javax/media/j3d/JoglPipeline.java index 2f38fd8..c45fd61 100644 --- a/src/javax/media/j3d/JoglPipeline.java +++ b/src/javax/media/j3d/JoglPipeline.java @@ -52,6 +52,7 @@ import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; +import com.jogamp.common.nio.Buffers; import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.nativewindow.AbstractGraphicsScreen; import com.jogamp.nativewindow.CapabilitiesChooser; @@ -61,7 +62,12 @@ import com.jogamp.nativewindow.NativeWindowFactory; import com.jogamp.nativewindow.ProxySurface; import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.VisualIDHolder; +import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; +import com.jogamp.nativewindow.awt.AWTGraphicsDevice; +import com.jogamp.nativewindow.awt.AWTGraphicsScreen; +import com.jogamp.nativewindow.awt.JAWTWindow; import com.jogamp.opengl.DefaultGLCapabilitiesChooser; +import com.jogamp.opengl.FBObject; import com.jogamp.opengl.GL; import com.jogamp.opengl.GL2; import com.jogamp.opengl.GLCapabilities; @@ -75,13 +81,6 @@ import com.jogamp.opengl.GLFBODrawable; import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.Threading; -import com.jogamp.common.nio.Buffers; -import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration; -import com.jogamp.nativewindow.awt.AWTGraphicsDevice; -import com.jogamp.nativewindow.awt.AWTGraphicsScreen; -import com.jogamp.nativewindow.awt.JAWTWindow; -import com.jogamp.opengl.FBObject; - /** * Concrete implementation of Pipeline class for the JOGL rendering * pipeline. @@ -6789,7 +6788,8 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { if (VERBOSE) System.err.println("JoglPipeline.updateMaterialColor()"); GL2 gl = context(ctx).getGL().getGL2(); - gl.glColor4f(r, g, b, a); + // FIXME: Removed call to glColor4f because of segfault issues in Parallels Desktop driver + // gl.glColor4f(r, g, b, a); gl.glDisable(GL2.GL_LIGHTING); } @@ -7068,6 +7068,8 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { gl.glDepthFunc(GL.GL_LEQUAL); gl.glEnable(GL2.GL_COLOR_MATERIAL); gl.glDisable(GL.GL_COLOR_LOGIC_OP); + gl.glDisable(GL.GL_STENCIL_TEST); + } // native method for setting default texture @@ -7218,9 +7220,10 @@ void swapBuffers(Canvas3D cv, Context ctx, Drawable drawable) { GL2 gl = context(ctx).getGL().getGL2(); - if (!enableLight) { - gl.glColor4f(r, g, b, a); - } + if (!enableLight) { + // FIXME: Removed call to glColor4f because of segfault issues in Parallels Desktop driver + // gl.glColor4f(r, g, b, a); + } gl.glShadeModel(GL2.GL_SMOOTH); } @@ -7693,7 +7696,11 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); - gl.glEnable(GL.GL_TEXTURE_2D); + gl.glEnable(GL.GL_TEXTURE_2D); + gl.glPushAttrib(GL2.GL_TRANSFORM_BIT); + gl.glMatrixMode(GL.GL_TEXTURE); + gl.glLoadIdentity(); + gl.glPopAttrib(); // loaded identity modelview and projection matrix gl.glMatrixMode(GL2.GL_PROJECTION); @@ -8307,7 +8314,8 @@ static boolean hasFBObjectSizeChanged(JoglDrawable jdraw, int width, int height) if (gct.getSceneAntialiasing() != GraphicsConfigTemplate.UNNECESSARY && gct.getDoubleBuffer() != GraphicsConfigTemplate.UNNECESSARY) { caps.setSampleBuffers(true); - caps.setNumSamples(2); + int numSamples = MasterControl.getIntegerProperty("j3d.numSamples", 2); + caps.setNumSamples(numSamples); } else { caps.setSampleBuffers(false); caps.setNumSamples(0); diff --git a/src/javax/media/j3d/MasterControl.java b/src/javax/media/j3d/MasterControl.java index 0d7af66..0bf27ab 100644 --- a/src/javax/media/j3d/MasterControl.java +++ b/src/javax/media/j3d/MasterControl.java @@ -779,6 +779,22 @@ private static String getProperty(final String prop) { }); } + static int getIntegerProperty(String prop, int defaultValue) { + int value = defaultValue; + String propValue = getProperty(prop); + + if (propValue != null) { + try { + value = Integer.parseInt(propValue); + } + catch (NumberFormatException e) {} + } + if (J3dDebug.debug) + System.err.println("Java 3D: " + prop + "=" + value); + + return value; + } + static boolean getBooleanProperty(String prop, boolean defaultValue, String trueMsg, @@ -833,6 +849,11 @@ private static String getProperty(final String prop) { // Use default pipeline } + // Java 3D cannot run in headless mode unless using the noop renderer + if (java.awt.GraphicsEnvironment.isHeadless() && pipelineType != Pipeline.Type.NOOP) { + throw new java.awt.HeadlessException(); + } + // Construct the singleton Pipeline instance Pipeline.createPipeline(pipelineType); diff --git a/src/javax/media/j3d/NodeRetained.java b/src/javax/media/j3d/NodeRetained.java index 83739da..662a730 100644 --- a/src/javax/media/j3d/NodeRetained.java +++ b/src/javax/media/j3d/NodeRetained.java @@ -624,9 +624,6 @@ NodeRetained getParent() { void recombineAbove() {} - synchronized void updateLocalToVworld() {} - - @Override void setLive(SetLiveState s) { int oldrefCount = refCount; diff --git a/src/javax/media/j3d/VirtualUniverse.java b/src/javax/media/j3d/VirtualUniverse.java index 624bccb..42e3725 100644 --- a/src/javax/media/j3d/VirtualUniverse.java +++ b/src/javax/media/j3d/VirtualUniverse.java @@ -262,13 +262,6 @@ ArrayList<Integer> viewIdFreeList = new ArrayList<Integer>(); } } - // Java 3D cannot run in headless mode, so we will throw a - // HeadlessException if isHeadless() is true. This avoids a - // cryptic error message from MasterControl.loadLibraries(). - if (java.awt.GraphicsEnvironment.isHeadless()) { - throw new java.awt.HeadlessException(); - } - // Load the native libraries and create the static // MasterControl object MasterControl.loadLibraries(); |