General questiosn about multithreading

I know that jMonkey supports multithgreading and we are making heavy use of that.

So far we are using GameTaskQueueManager to submit everything we do to the OpenGL thrad.

I am wondering now what is required to run in the OpenGL thread and what not.

I saw in some of the examples (namely darkfrogs tutorial) that someone creates an object, attaches it to the scene graph and runs the updateState methods and all of that without using a callable.

So what has to be submit to the GameTaskQueueManager and what not?

Is there a guide available?

There’s actually very few methods that need to be called in the GL thread (that is a good thing), jME caches most changes and only applies them when it begins rendering. If you’re going to modify your scene graph, then you will need to lock the GL thread while you do so, however.

I listed some methods in my list of issues thread:

Here are some methods which make GL calls:

Probably all methods with the word 'draw' or 'render' in the name
JMEDesktop.setup and all it's constructors (It's generally bad to have GL code in constructors, because they are usually created in game loading threads)
MotionBlurRenderPass.reloadShader and it's constructor
WaterRenderPass.reloadShader and it's constructor
Spatial and friends.lockMeshes (this is also problematic because locks are made in game loading threads)
Spatial and friends.unlockMeshes

I was aware of that but so far I am still a little confused what constitutes a change to the scenegraph.

Is adding a new object a change?

Or just if I change the object after it is added to the scenegraph?

Thanks a lot for the list and the hint for the thread I am already wielding my Axe +2 of Callable mutilation and wiping out a lot of my callables.

Adding is definitely a change to the scene graph. As a rule of thumb, anything that involves nodes or states is a change to the scene graph (i.e. everything  :P). Changing bounds, geometry, adding/removing objects, changing transforms, etc.

Momoko_Fan, can you add those to a section of the Wiki, if they're not already on there?  I hadn't known you had started such a list until I read this.  Very cool, definitely a must have for anyone using StandardGame.

it is definately useful~ even im not using standardgame, im still making use of multithreading on all my game states.

thx for the list~

This list is by no way conclusive, I just did a quick search on the jME source for usage of some common GL calls and listed them here as an example.

But at least it is a list, that's more than I got before  :smiley: