Hi,
I’m kinda ashamed to ask this question, since I am on a level with jME where everything should be covered by the tutorials. In fact, I didn’t do a full game yet, but I want to try. So I worked through the beginners’ tutorials, read some documentation (incl. API documentation) and stuff.
Since I am a software developer, I am confident to say I got the main points of jME and I decided to use it for my first 3D-Game. I thought I’d be too easy to use the Simple Application, mainly because I don’t like the splash screen and that all-in-one-update-method. So I worked up the courage to write that evil “extends Application”.
We’ll, at first, I want to go the easy way and just display a box (kinda hello world). So I built a geometry and tried to put a material on it:
Geometry geom = new Geometry(“Box”, b);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”); // ← here!
mat.setColor(“Color”, ColorRGBA.Blue);
geom.setMaterial(mat);
rootNode.attachChild(geom);
(I built that rootNode myself, don’t know yet if it’ll work). On that comment I get a NullPointerException. I did some syso and learned that the assetManager is null. A null object is indeed a lousy assetManager. But I don’t find any documentation how to instanciate one; even with DesktopAssetManager (which extends the assetManager, I assume it’s some kind of default assetManager) it doesn’t work (I tried assetManager = new DesktopAssetManager()). All that forum- and wiki-searching found a lot of how to USE the assetManager, but nothing how to GET it. Mostly they say that it’s just available in the Application… not in my case
I do want to stick with the application, so I’d ask you to show me were I find how to instanciate oder initialize that little guy. Without assets, my game will be very boring.
Thanks for your help
Im on my IPhone now, but It should get init in the Application class
Here is the simple application source:
http://code.google.com/p/jmonkeyengine/source/browse/branches/jme3/src/core/com/jme3/app/SimpleApplication.java?r=4936
perhabs you forgot the super() or the super.initalise?
okay super inthe constructure. JmeSystem.newAssetManager()
Yep, I didn’t super.initialise(). Kinda missed that part in the documentation.
Thank you
Really, the only difference between “extends Application” and “extends SimpleAppliction” is all of the work you have to do that was already done for you in SimpleApplication… and the pitfalls you will hit trying to do them right. (How come app states aren’t updating?, etc.)
By splash screen do you mean the settings dialog? You can turn off the automatic pop-up of that. setShowSettings(false)
I’m not sure what you mean by the “all in one” update loop, either. SimpleApplication.update() does the bare essentials. And without things like rootNode.updateGeometricState(), etc. you will wonder why your scene is erroring out.
…otherwise, from an app’s perspective, I’m not sure what the difference is between overriding Application.update() (and remember to call super.update() or break everything) and SimpleApplication.simpleUpdate() which is safe to extend without breaking things.
Can you explain more what you mean about that “that all-in-one-update-method”?