Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 593 Members - Latest Member: zhang

19. June 2013, 07:09:31 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)How to get started with XIN
Pages: [1]
Print
Author Topic: How to get started with XIN  (Read 665 times)
ncarter
Just dropped in

Offline Offline

Posts: 5



View Profile
« on: 20. September 2011, 02:55:07 pm »

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!

Code:
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();
}
}
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #1 on: 20. September 2011, 08:05:27 pm »

Wow, this code is really, really outdated. It still uses the old jtank input library and the Canvas3DWrapper. These don't exist anymore.

Just copy one of the testcases from xith-tk.
Logged
ncarter
Just dropped in

Offline Offline

Posts: 5



View Profile
« Reply #2 on: 20. September 2011, 09:07:54 pm »

If I click one of the test cases in xith-tk and choose Run > As Java Application, various errors prevent it from running.  I tried several tests; all compiled, but various things went wrong, depending on which test I chose.  None ran successfully, but instead did one of these two things:
  • Never actually launched a window, but just sort of hung and I had to hit the red stop button.
  • Crashed with the error "Invalid memory access of location 0x0 rip=0x10db1697f" (or a different location)
Usually the above two behaviors were accompanied with a lot of these on the console:
2011-09-20 16:54:01.815 java[89729:ef03] *** -[NSConditionLock unlock]: lock (<NSConditionLock: 0x7fe3e1aa5a30> '(null)') unlocked when not locked
2011-09-20 16:54:01.816 java[89729:ef03] *** Break on _NSLockError() to debug.


So then I tried starting a new project and pasting the code from a xith-tk test into it, renaming the classes as appropriate.  That compiled okay, but then the resources that come with xith-tk aren't found, so it won't run successfully either.
Exception in thread "main" java.lang.IllegalArgumentException: Resource not found "test-resources/"
   at org.xith3d.resources.ResourceLocator.<init>(ResourceLocator.java:537)
   at org.xith3d.resources.ResourceLocator.create(ResourceLocator.java:569)
   at org.xith3d.test.util.TestUtils.createResourceLocator(TestUtils.java:66)
   at org.xith3d.test.XithTest.<init>(XithTest.java:135)
   at org.xith3d.test.XithTest.main(XithTest.java:161)

(This was my personal clone of org.xith3d.test.geometry.CylinderTest.)  Maybe there's some way to move the resources over, but I'm new to Eclipse and don't know it.

So I figured I better go learn something, and I noticed that there are tutorials that come with xith-tk.  But there are only two: XIN (which started this thread) and another one on scene graphs.  That one contains, unfortunately, the same outdated example from my original post.  Square one.

Am I just reading all the wrong stuff, or do there simply not exist valid instructions for how to get started with Xith?
Logged
ncarter
Just dropped in

Offline Offline

Posts: 5



View Profile
« Reply #3 on: 20. September 2011, 09:12:56 pm »

Update:  It turns out to be super-easy to copy the test resources over.  It's, um, Copy and then...Paste. Smiley

However, unfortunately, this still yields an application that gives an Invalid memory access error, like it did before.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #4 on: 21. September 2011, 08:34:59 am »

This very much looks like you have outdated or crippled drivers.

When copying the testcases you should make sure to also copy the code from Xith3DTest, since you won't want to let your own project depend on xith-tk Wink.
Logged
ncarter
Just dropped in

Offline Offline

Posts: 5



View Profile
« Reply #5 on: 21. September 2011, 01:18:58 pm »

I appreciate your kind attention to this forum, but this is getting a little silly.

I am using a Mac, the same one on which I can successfully play Minecraft (OpenGL+Java) and run 3D OpenGL-based scientific visualization apps.  I therefore can't imagine that the drivers are crippled or horribly out of date, but I wouldn't know how to check in any case.  I stopped worrying about drivers when I bought my first Mac, and can hardly say I miss it.

Regarding your comment about copying code, although it makes sense, it brings me back to the bigger problem:  The process for getting up-and-running with Xith3D can't possibly be to come to this forum and use up both our time each time something goes wrong.

Is there or isn't there an up-to-date tutorial for getting started with Xith3D?  If not, then despite your kind help, I'm sorry, but I'll use a different toolkit.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #6 on: 21. September 2011, 05:49:56 pm »

XIN should be fairly up to date. And it should really get you started. Problems like you report above usually don't happen and I have never seen something similar except when there're issues with the drivers. Hence my conclusion.

If we can't work this out without an intense use of my time, then I encourage you to use a different toolkit. But you should first check, if you get it to work on a different system. I myself have never tried it on a mac. But I have successfully developed and used it on linux and windows and I know of others, using it on a mac.
Logged
ncarter
Just dropped in

Offline Offline

Posts: 5



View Profile
« Reply #7 on: 21. September 2011, 05:53:25 pm »

Thank you for your help, and please take no offense, but I'm having an excellent experience with jMonkeyEngine 3's IDE and tutorials, so I will be using that platform.  Thank you again.
Logged
stemcd
Just dropped in

Offline Offline

Posts: 3


View Profile
« Reply #8 on: 29. September 2011, 07:47:47 am »

FYI: I use six year old mac book (not pro) with bog standard drivers and everything works fine for me.  I am relatively new to xith3d but I am doing some fairly none-trivial stuff with it.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4403


May the 4th, be with you...


View Profile
« Reply #9 on: 29. September 2011, 05:46:10 pm »

Thanks for the info.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic