Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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  
  Bug in Xith3D tutorial  (Read 1610 times)
0 Members and 1 Guest are viewing this topic.
Offline kaffiene
« Posted 2004-02-16 00:07:22 »

I coded up the 'HelloXith3D' code in the getting_started_guide.pdf file.

On two different machines I have compiled this code (both against the CVS HEAD and the last stable release)  And on both machines I get  a NullPointerException:

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:192)
     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(Unknown Source)



The main bit of the code is like so:



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

       View view = new View();
       universe.addView(view);
       Locale locale = new Locale();
       universe.addLocale(locale);

       BranchGroup 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);

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

       scene.compile();

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

       view.getTransform().lookAt(new Vector3f(0, 0, 2.41f), // location of eye
       new Vector3f(0, 0, 0), // center of view
       new Vector3f(0, 1, 0)); // vector pointing up
       view.startView();

   }

Offline kaffiene
« Reply #1 - Posted 2004-02-16 07:14:46 »

Can anyone suggest what might be going wrong?  I've compared the code with the CubeTest.java demo code and I couldn't find any obvious architectural faults from what I know of how it should be working.

I'm a newbie trying to learn Xith3D, and I'd like to be able to work through the rest of the tutorials.

Any help would be greatly appreciated.
Offline kaffiene
« Reply #2 - Posted 2004-02-16 08:28:53 »

Neato, another post in My Very Own Thread...

I've really enjoyed talking to myself :)

Anyway, I've figured out what the problem was by working through the com.xith3d.render.jogl.ShapeAtomPeer.renderAtom() code.  The problem is that the tutorial doesn't define an appearance for the cube and the renderAtom code assumes that the shape will have an appearance (on line 688)

This is either a bug with the code or the tutorial.  Someone who knows better than I should fix one or the other - it's obviously not desirable to have newbs fail on the first tutorial :)

Cheers,

Peter.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kevglass

JGO Kernel


Medals: 123
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #3 - Posted 2004-02-16 08:42:49 »

Na, I'm listening, honest  Grin

Well done for finding the bug, its actually in the tutorial although some extra debug might be nice in the code.

I think currently a shape without an Appearance won't be displayed, I didn't realise it crashed but I guess so Smiley

Well done again,

Kev

Offline dsellars

Junior Member




Need to write more games


« Reply #4 - Posted 2004-02-16 09:36:53 »

Sorry just looked in on this or I would have replied sooner.

I had this problem when I first looked at it as well.  I think that the actual code that you can downlod is ok but the text in the tutorial is wrong.

Still at least you've got it sorted now ;-)

Dan.
Offline Jens

Senior Member




Java for games!


« Reply #5 - Posted 2004-02-16 11:23:45 »

I fixed this issue and committed the changes to CVS (the sourcecode in the GSG example is not wrong).

Additionally I fixed another Joal compile error. I wonder why no one complained about this one or didn't you get any error when compiling Xith3D with ant?

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline kaffiene
« Reply #6 - Posted 2004-02-16 17:35:27 »

Quote

Additionally I fixed another Joal compile error. I wonder why no one complained about this one or didn't you get any error when compiling Xith3D with ant?


No, I didn't get any errors compiling at all - worked straight out of the box :-)

Having just spent *days* trying to get OpenSceneGraph to compile and spitting tacks at *&^#^!@ing template errors, Xith3D's swift and error-free compile was a welcome relief :-)
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #7 - Posted 2004-02-16 17:58:59 »

Jens, something definitely went wrong with JOAL driver...

Quote
Additionally I fixed another Joal compile error. I wonder why no one complained about this one or didn't you get any error when compiling Xith3D with ant?


I just triple-checked the JOAL source, and it still throws an exception in ALFactory.getAL():

1  
  public static AL getAL() throws OpenALException


Can you pls check this again, because of I am not sure if current CVS version is OK... or maybe I am doing something wrong or using wrong version [I use JOAL from JOAL CVS]?

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Jens

Senior Member




Java for games!


« Reply #8 - Posted 2004-02-16 18:32:29 »

Hello Yuri,

it's my fault.  :-/ I wasn't aware of Will's temporary hack some days ago and somehow didn't update the jar's properly. I reverted to the last version of the sound driver in CVS now. I'm really sorry. It should work fine for you again, now.

Jens

Xith3D Getting Started Guide (PDF,HTML,Source)
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #9 - Posted 2004-02-16 18:38:34 »

Hi,

Quote
I'm really sorry. It should work fine for you again, now.


Thanks for a quick fix. And don't worry about this - we have CVS anyway, so this is not a big problem.

Yuri

Yuri Vl. Gushchin
JProof Group
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #10 - Posted 2004-02-17 02:42:27 »

Quote
Hello Yuri,

it's my fault.  :-/ I wasn't aware of Will's temporary hack some days ago and somehow didn't update the jar's properly. I reverted to the last version of the sound driver in CVS now. I'm really sorry. It should work fine for you again, now.

Jens


Yes, thanks for fixing it quick - in fact it was fixed before I even saw it was broken Smiley.  I was surprised so few things broke when I updated the JOGL and JOAL libraries for xith3d considering how out of date they were.

Incidently that "temporary" hack will pretty much have to be permanent unless enough people want checked exceptions (as per my old thread).

Will.

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.

CogWheelz (12 views)
2014-08-01 22:53:16

CogWheelz (14 views)
2014-08-01 22:51:43

CopyableCougar4 (15 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

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

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

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

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

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

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

Resources for WIP games
by CogWheelz
2014-08-01 18:19:50

List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

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
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!