Problem with OpenGL threads!

Hi everybody,



I would like to know in detail why I usually get an Null Pointer Exception:



    _ I'm using FengGUI lib.

    _ When I try to create an texture renderer, or an texture2D, or something like that. I mean everything in JMonkey that use OpenGL thread to render by 2D type. I get an NPE.



However, for example, I make an texture renderer in OpenGL thread (initiate it in callabe() method), It's OK!



And now, I need to know more detail about OpenGL thread. From that result, I can manage the texture 2D rendering of JMonkey and the 2D object rendering of FengGUI exactly!

i guess you use StandardGame, some things who access the OpenGL Context, need to be done in the OpenGL thread.

see also this wiki entries:

http://www.jmonkeyengine.com/wiki/doku.php?id=what_calls_must_be_made_from_the_opengl_thread

http://www.jmonkeyengine.com/wiki/doku.php?id=some_standardgame_frequently_asked_questions&s[]=opengl

yeah, I'm using StandardGame. Some things who access the OpenGL context, need to be done in the OpenGL thread.    For that reason, I want to manage this OpenGL thread. For example, I have the following threads:

  1) OpenGL thread

  2) The threads are used in client-server connection.



When server return an object, client will get and render this object. However, there're some risks maybe appear. When client-server thread return an object, I attach this object into rootNode. NPE sometimes be thrown.



It's better if we can make sure the "attached into" action is always performed in OpenGL thread.

The wiki goes into details about how all this works and why.