Re: Mac Canvas3D location bug
Posted by
Sven Gothel on
Oct 05, 2013; 1:05pm
URL: https://forum.jogamp.org/Mac-Canvas3D-location-bug-tp4030052p4030159.html
On 10/05/2013 02:34 PM, Manu [via jogamp] wrote:
> The canvas 3D is placed correctly in a frame now, but is misplaced in a child
> dialog.
> This can be tried with the simple following test where the canvas 3D doesn't
> appear at the good location:
>
> import java.awt.GraphicsEnvironment;
> import javax.media.j3d.*;
> import javax.swing.*;
> import com.sun.j3d.utils.universe.SimpleUniverse;
>
> public class Canvas3DPositionInDialogTest {
> public static void main(String [] args) {
> // Create a minimal canvas 3D
> GraphicsConfigTemplate3D gc = new GraphicsConfigTemplate3D();
> Canvas3D canvas = new Canvas3D(GraphicsEnvironment.getLocalGraphicsEnvironment().
> getDefaultScreenDevice().getBestConfiguration(gc));
> canvas.setSize(100, 100);
> new SimpleUniverse(canvas);
>
> // Display the canvas 3D in a dialog child of a frame
> JFrame frame = new JFrame("Canvas3DPositionTest");
> frame.setSize(400, 400);
> frame.setVisible(true);
> JOptionPane.showMessageDialog(frame, canvas);
> }
> }
>
>
> I think that when you look for the location of the canvas 3D at screen, you
> should go up in the components hierarchy until you find a parent of Window
> class, and not until you get a null parent. Hope this will help...
Thank you .. will try this out .. yes, should stop at top level HW component.
> Did you have the chance to look at the other issue I reported in the
> Canvas3DVisibilityTest class?
Yes, as you can see in the unit tests - should be fixed, at least my manual
test was positive.
~Sven
> Emmanuel Puybaret