Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
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  
  Dumping core and I'm not sure why...  (Read 1324 times)
0 Members and 1 Guest are viewing this topic.
Offline gregorypierce

Senior Devvie




I come upon thee like the blue screen of death....


« Posted 2004-02-11 02:59:53 »

I was running through some of the getting started stuff for Xith3D just to make sure the Mac audience can run Xith because I've been pinged on it more than once recently. When I tried to put Xith into a JInternalFrame suddenly I get a funky exception and I can't really figure out what Xith is trying to do here.

Basically I took the code from the Getting Started guide and slapped it into a cheesy rendering window class which simply encapsulates the functionality of the tutorial in a class:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
public class RenderingWindow
{
    public static Logger logger = Logger.getLogger("RenderingWindow");

    private VirtualUniverse                     universe;
    private View                                view;
    private BranchGroup                         scene;
    private Canvas3D                            canvas;

    public RenderingWindow()
    {
        universe = new VirtualUniverse();

        view = new View();
        universe.addView( view );

        Locale locale = new Locale();
        universe.addLocale( locale );

        scene = new BranchGroup();
        locale.addBranchGraph( scene );

        Transform3D rotate = new Transform3D();
        rotate.rotXYZ( (float) Math.PI/4,
                       (float) Math.PI/5,
                       (float) Math.PI/2);

        TransformGroup objRotate = new TransformGroup( rotate );
        scene.addChild( objRotate );

        Geometry g = Cube.createCubeViaTriangles( 0, 0, 0, 1, true );
        Shape3D shape = new Shape3D( g );
        objRotate.addChild( shape );

        scene.compile();

        RenderPeer rp = new RenderPeerImpl();
        CanvasPeer cp = rp.makeCanvas( null, 640, 480, 32, false );
        canvas = new Canvas3D();
        canvas.set3DPeer(cp);
        view.addCanvas3D( canvas );

        view.getTransform().lookAt(
                new Vector3f( 0, 0, 5 ),
                new Vector3f( 0, 0, 0 ),
                new Vector3f( 0, 1, 0 )
        );

        view.startView();

    }

    public Canvas3D getCanvas()
    {
        return canvas;
    }
}


I then set up the cheesy rendering window in a JDesktop using the following

1  
2  
3  
4  
JInternalFrame frame = new JInternalFrame();
        RenderingWindow window = new RenderingWindow();
        frame.getContentPane().add( window.getCanvas() );
        Studio.getInstance().getWorkspaceArea().add( frame );



I'm not sure why, but this yields the following null pointer exception and I'm having a hard time tracking it down.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
java.lang.NullPointerException
      at com.xith3d.render.jogl.ShapeAtomPeer.renderAtom(ShapeAtomPeer.java:688)
      at com.xith3d.render.CanvasPeerBase.render(CanvasPeerBase.java:102)
      at com.xith3d.render.jogl.CanvasPeerImpl.drawBin(CanvasPeerImpl.java:678)
      at com.xith3d.render.jogl.CanvasPeerImpl.display(CanvasPeerImpl.java:849)
      at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74)
      at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:194)
      at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:235)
      at net.java.games.jogl.impl.macosx.MacOSXOnscreenGLContext.invokeGL(MacOSXOnscreenGLContext.java:79)
      at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:182)
      at net.java.games.jogl.GLCanvas.display(GLCanvas.java:82)
      at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:950)
      at com.xith3d.scenegraph.View.renderOnce(View.java:732)
      at com.xith3d.scenegraph.View.renderOnce(View.java:665)
      at com.xith3d.scenegraph.View$ViewRunner.run(View.java:1334)
      at java.lang.Thread.run(Thread.java:552)



http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline gregorypierce

Senior Devvie




I come upon thee like the blue screen of death....


« Reply #1 - Posted 2004-02-11 03:28:54 »

I've traced the problem to this offending line of code

1  
                TextureUnitState tu[] = shape.getAppearance().getTextureUnitState();


The problem being that the shape I created didn't have an appearance. So here is the problem, there needs to be a try/catch around the actual shape.getAppearance() so that it can catch a null appearance

- or -

The constructor for shape that doesn't take an appearance needs to be nuked.

Personally I think that the first option is the best and that the Xith layer should catch the null pointer exception and notify the developer that there is a problem with no Appearance being specified as this blows up the engine Smiley

In addition, the documentation needs to be updated so that this is covered since this is a fairly critical error with the first 7 pages of doc. If anyone wants me to tackle any of this, lemme know.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline Jens

Senior Devvie




Java for games!


« Reply #2 - Posted 2004-02-11 05:32:52 »

See https://xith3d.dev.java.net/issues/show_bug.cgi?id=21. This issue is open for quite some time now.

I did make a change to the GSG, but only in the sourcecode, because I assumed most people download the sourcecode anyway and didn't want to present "workarounds" in the GSG (the workaround is to use another constructor). You are the second person having this problem, so I'll either update the guide or we fix this issue immediately (preferred).

Xith3D Getting Started Guide (PDF,HTML,Source)
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jens

Senior Devvie




Java for games!


« Reply #3 - Posted 2004-02-11 06:07:24 »

OK, I fixed this issue now and added it as a patch to #21. It was a code structure error: Xith3D tried to draw a multitexture, when no appearance is specified.

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2004-02-11 06:28:55 »

There was also some discussion a while back regarding the current sitation with many Unchecked exceptions being thrown.  In that case, Xith3D is noting a problem then throwing an Error.  What is your stance on that?  I wouldn't mind reviving that discussion as nothing was decided in the end.

Will.

Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1567 views)
2018-06-10 19:43:48

EgonOlsen (1538 views)
2018-06-10 19:43:44

EgonOlsen (1141 views)
2018-06-10 19:43:20

DesertCoockie (1567 views)
2018-05-13 18:23:11

nelsongames (1171 views)
2018-04-24 18:15:36

nelsongames (1548 views)
2018-04-24 18:14:32

ivj94 (2305 views)
2018-03-24 14:47:39

ivj94 (1514 views)
2018-03-24 14:46:31

ivj94 (2601 views)
2018-03-24 14:43:53

Solater (878 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
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!