Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  switching 3D-window between two Windows?  (Read 525 times)
0 Members and 1 Guest are viewing this topic.
Offline BrainPlug

Senior Newbie





« Posted 2005-08-27 12:19:46 »

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(TM) 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  Huh
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (37 views)
2013-05-17 21:29:12

alaslipknot (46 views)
2013-05-16 21:24:48

gouessej (75 views)
2013-05-16 00:53:38

gouessej (75 views)
2013-05-16 00:17:58

theagentd (83 views)
2013-05-15 15:01:13

theagentd (77 views)
2013-05-15 15:00:54

StreetDoggy (119 views)
2013-05-14 15:56:26

kutucuk (143 views)
2013-05-12 17:10:36

kutucuk (143 views)
2013-05-12 15:36:09

UnluckyDevil (153 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.114 seconds with 21 queries.