Newbie needs some help

I’m tearing my hair out with this one. I’ve been programming Java for about 7 years, and before that I was doing low level 3D stuff (hand-coding line drawing, polygon filling, and transforms in assembly), so I have something of a background in 3D, just not Java3D.

I’ve done various searches here and on Google, but I can’t find any remedy.

I’ve been working on the a tutorial (http://www.j3d.org/tutorials/raw_j3d/index.html) and I’ve gotten to the end of chapter one where, supposedly, my program should produce a display with a square. I can’t for the life of me figure out why it isn’t displaying. All I get is a black window, no square.

I hate posting a pile of code and asking other people to help me, but I fear I have no choice this time. I’m totally stumped.

I’ve zipped up my code, complete with ant build script and batch file to start to app. I’ve posted it on my server: http://www.bennedum.org/files/Plasma3D.zip

Could someone please take a look and tell me what I’m missing? Please?

-Tab

After getting some sleep and calming down a bit, I realized I left out some pertinent info from my previous post.

First of all, there’s only 4 source files in the download: Plasma3d.java implements main, Universe.java implements the VirtualUniverse, Camera.java implements the view, and World.java implements the geometry. Together, the files implement a minimal 3d setup without using any of the utility classes in java3d. When I use the SimpleUniverse class from the utilities in other apps, I can get things working, but I don’t want to use SimpleUniverse because I need more control over the view (when I get a bit further with my app).

I can run various demos from the java3d package successfully, so I know java3d is essentially working on my setup (which is java 1.4.1_01 and java3d 1.3.1 on WinXP Pro SP1).

Given the info here, I’m led to believe the problem is in the view related class (Camera.java) and not the geometry class (World.java). However, since I don’t know what’s wrong, who am I to judge?

I’ve tried fiddling with the camera location and geometry location, thinking maybe I wasn’t seeing anything because it wasn’t in view. I’ve also tried adding some ambient lighting, thinking I didn’t have enough light. None of these things worked, which again leads me to believe there’s something wrong in Camera.java.

I’m still stuck on this. Any help would be appreciated. Please? I can post the code directly to the forum if requested.

-Tab

I solved the problem. If I had the author of the tutorial in front of me now, I’d strangle him. It will always be a mystery to me why some authors don’t test the code they publish.

The problem was the geometry all along. The 4 coords used to define the square were defined in the wrong order so the geometry was being backface culled. Reverse the order and the square appears.

What irks me most is that the author made a point of mentioning the order of the points to prevent just this problem. In a later section of the tutorial, he reveals that j3d uses the right-hand-rule for culling. His orginal example was based on the lef-hand-rule.

I’ll try to drop the author a note so he can correct the tutorial.

-Tab

hehe, I hear that. The Java3D API Jump Start book is riddled with errors in the examples too.

Will.