Hello, Xith community.
I'm sort of a novice and sort of not; here's my situation:
- Things I know well: programming, OpenGL, the basics of scene graphs
- Things I don't know much about at all: Eclipse, Xith
(Java I knew well long ago and am coming back into it.)
I followed tutorials to successfully accomplish these tasks:
- Get Eclipse and do a simple hello world to make sure it works and I know the very basics of Eclipse.
- Followed the tutorial at
http://xith.org/downloads/docs/Xith3D%20Installation%20from%20SVN.pdf to check out Xith and its toolkit from SVN.
However, step 4 of that tutorial tries to tell me how to build a test app. The problem is that it is out-of-date. I've been able to fix some of the problems myself by digging around and thinking a bit, but still have several errors remaining that I don't know how to fix.
I attach below my updated version of the test app code from the above tutorial, with several imports and constructor calls updated as best I could figure out how. Those things that I cannot fix I have indicated with comments in the code. Any help would be appreciated.
If we complete this, maybe it will be a useful resource to someone as they update the tutorial. Thank you!
package org.xith3d.test;
import java.io.File;
import org.openmali.vecmath2.Tuple3f;
import net.jtank.input.KeyCode;
// Above line has this error: "The import net.jtank cannot be resolved."
// I guess I need to get jtank and include it in this project somehow, but that was not in the tutorial.
// I see it's only used for one key code below; perhaps something in org.xith3d.input or .io could suffice??
import org.xith3d.scenegraph.primitives.Cube;
import org.xith3d.loaders.texture.TextureLoader;
import org.xith3d.loaders.texture.TextureStreamLocatorFile;
// The above class is simply not in the org.xith3d.loaders.texture package (if that's the right term).
// There's a TextureStreamLocatorZip, but not this one. What to do?
import org.xith3d.base.Xith3DEnvironment;
import org.xith3d.render.Canvas3DWrapper;
import org.xith3d.render.Canvas3DWrapper.Resolution;
// The above class is also not there. In fact, Canvas3DWrapper is just an interface with one method,
// which is not the method that the code below tries to call. (See comments below.)
import org.xith3d.loop.RenderLoop;
import org.xith3d.scenegraph.BranchGroup;
public class XithTest extends RenderLoop
{
public void onKeyReleased(int key)
{
switch (key)
{
// The next line is the one place where net.jtank.input.KeyCode is used.
case KeyCode.VK_ESCAPE:
this.end();
break;
}
}
private BranchGroup createScene()
{
Cube cube = new Cube( 3.0f, "stone.jpg" );
BranchGroup bg = new BranchGroup();
bg.addChild( cube );
// One of my more baffling errors is that the next line says
// "Insert ; to complete ReturnStatement."
// Huh? That's a perfectly valid return statement as far as I can tell, with a semicolon!
// Is this one of those errors that goes away if you fix other things first?
return bg;
}
public XithTest()
{
super( 128L );
Xith3DEnvironment env = new Xith3DEnvironment( new Tuple3f( 3f, 2f, 5f ),
new Tuple3f( 0f, 0f, 0f ),
new Tuple3f( 0f, 1f, 0f ),
this );
// The following line is where Canvas3DWrapper's nonexistant createStandalone() is invoked,
// and where the Resolution class that can't be found is attempted to be used.
Canvas3DWrapper canvas = Canvas3DWrapper.createStandalone(
Resolution.RES_800X600, "My empty scene" );
this.registerKeyboardAndMouse( canvas );
env.addCanvas( canvas );
TextureLoader.getInstance().addTextureStreamLocator(
new TextureStreamLocatorFile( new File( "demo/textures") ) );
env.addPerspectiveBranch( createScene() );
// The next line has the same baffling semicolon error from the end of the previous method.
this.begin();
}
public static void main(String[] args)
{
// And another funny semicolon here, this one says insert semicolon to complete BlockStatements.
// Again, I'm guessing this may go away if other things are fixed first. Yes?
new XithTest();
}
}