Login  Register

Re: Mac Canvas3D location bug

Posted by Manu on Dec 09, 2013; 9:23am
URL: https://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4030838.html

Hi,
I don't know if I should continue to post here or create an other subject, but I've been trying under Mac OS X the first Beta of Java 7u60 where the Canvas3D location bug seems to be back.
Before contacting Oracle team, are you aware of some additional changes that should be made in JOGL or Java 3D for this future Java release, or do you think it's a regression in Java?
You can test the issue with this simple program that displays a 3D canvas in the top right corner of a frame:
import java.awt.GraphicsEnvironment;
import javax.media.j3d.*;
import javax.swing.*;
import com.sun.j3d.utils.universe.SimpleUniverse;

public class Canvas3DPositionTest {
  public static void main(String [] args) {
    // Create a canvas 3D
    GraphicsConfigTemplate3D gc = new GraphicsConfigTemplate3D();
    Canvas3D canvas = new Canvas3D(GraphicsEnvironment.getLocalGraphicsEnvironment().
        getDefaultScreenDevice().getBestConfiguration(gc));
    new SimpleUniverse(canvas);

    // Build a GUI where the canvas 3D is located at top right of the frame 
    // and can be resized with split panes dividers
    JFrame frame = new JFrame("Canvas3DPositionTest");
    JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
        true, canvas, new JScrollPane());    
    verticalSplitPane.setResizeWeight(0.5);
    JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, 
        true, new JScrollPane(), verticalSplitPane);
    horizontalSplitPane.setResizeWeight(0.5);
    JRootPane intermediateRootPane = new JRootPane();
    intermediateRootPane.setContentPane(horizontalSplitPane);
    frame.add(intermediateRootPane);
    frame.setSize(400, 400);
    frame.setVisible(true);
  }
}
Move the horizontal splitter and you'll see that the canvas 3D location is incorrect one time out of two.
Emmanuel Puybaret