Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 663 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.

 

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

The first screenshot will be displayed as a thumbnail.

Riven (5 views)
2014-07-29 18:09:19

Riven (4 views)
2014-07-29 18:08:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!