switching 3D-window between two Windows?

Hello everyone,

I hope that someone can help me. I’m writing an application where I need the same 3D-Window in two different JPanels. When the 3D-stuff is visible in the first Panel it is not in the other. But it does not work, I always get an Error caused by “ialmgicd.dll”.

An unexpected error has been detected by HotSpot Virtual Machine:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0354331d, pid=228, tid=188

Java VM: Java HotSpot™ Client VM (1.5.0-b64 mixed mode, sharing)

Problematic frame:

C [ialmgicd.dll+0x4331d]

An error report file with more information is saved as hs_err_pid228.log

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

I have written a short example to demonstrate the problem.

import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.vecmath.Vector3f;
import com.xith3d.render.CanvasPeer;
import com.xith3d.render.RenderPeer;
import com.xith3d.render.jogl.RenderPeerImpl;
import com.xith3d.scenegraph.Appearance;
import com.xith3d.scenegraph.BranchGroup;
import com.xith3d.scenegraph.Canvas3D;
import com.xith3d.scenegraph.Locale;
import com.xith3d.scenegraph.Shape3D;
import com.xith3d.scenegraph.View;
import com.xith3d.scenegraph.VirtualUniverse;
import com.xith3d.test.Cube;

public class Test implements Runnable {

JFrame frame1;
JFrame frame2;
JPanel content;
View view;
boolean flip = true;

public Test() {
    frame1 = new JFrame() {
        {
            setSize(320, 200);
            setVisible(true);
            getContentPane().setLayout(new BorderLayout());
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    };
    frame2 = new JFrame() {
        {
            setSize(640, 480);
            setLocation(320, 200);
            setVisible(true);
            getContentPane().setLayout(new BorderLayout());
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    };
    content = new JPanel() {
        {
            setLayout(new GridLayout(1, 1));
        }
    };
    VirtualUniverse universe = new VirtualUniverse();
    view = new View();
    universe.addView(view);
    Locale locale = new Locale(5.0f, 0.0f, 10.0f);
    universe.addLocale(locale);
    BranchGroup root = new BranchGroup();
    locale.addBranchGraph(root);
    root.addChild(new Shape3D(Cube.createCubeViaTriangles(0, 0, 0, 1,
                    true), new Appearance()));
    root.compile();
    view.getTransform().lookAt(new Vector3f(0, 0, 2f),
            new Vector3f(0, 0, 0f), new Vector3f(0, 1, 0));
    RenderPeer rp = new RenderPeerImpl();
    CanvasPeer cp = rp.makeCanvas(content, 640, 480, 32, false);
    Canvas3D canvas = new Canvas3D();
    canvas.set3DPeer(cp);
    view.addCanvas3D(canvas);
    new Thread(this).start();
}

public static void main(String[] args) {
    new Test();
}

public void run() {
    while (true) {
        flip = !flip;
        if (flip) {
            frame1.getContentPane().removeAll();
            frame2.getContentPane().add(content);
        } else {
            frame2.getContentPane().removeAll();
            frame1.getContentPane().add(content);
        }
        view.renderOnce();
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
        }
    }

}

}

anyone can help me out ???