Noob Question?

i read the thread: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies and i have the following question:



Suppose I have a node called nodeScene, I add an image to that node, then I add another node called nodeModel. This new node has a spatial (model).



How I can assign the order in which they appear? for example the image should go as background and the model ahead of the image.



I tried with the information in this thread:

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/setting-a-stationary-background-image-in-jme3/



but I get an error and the application closes




Uploaded with ImageShack.us

Well with that error, you are adding something to the scene outside of the update (render) loop. Make sure when you add something to the scene it is on the render loop. https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:multithreading



You will have to describe more of what you are trying to achieve. Just a background image doesn’t mean too much. Do you want a skybox? A stationary background image in 2d with 3d in front of it?

@Sploreg said:
You will have to describe more of what you are trying to achieve.


I'm trying to make a 2D scene, one image as background and a model in front of the image.

this is an example of what i'm trying to do, made with skybox and a model:

Uploaded with ImageShack.us

I think you’ve created your own viewport but then you don’t manage it properly. There are some spatial update methods that need to be called on the ViewPort’s spatial at the right time. If you never change what’s in the viewport then you may only need to call them once.



http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Spatial.html#updateLogicalState(float)

http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Spatial.html#updateGeometricState()



You can also search for ViewPortState… because I’ve posted an AppState that can manage viewports at least once.

Please don’t double-post.