StandardGame lock/unlock unhappiness

This one is for someone more knowledgeable about the OpenGL single-threadedness requirements than me.  It would seem that even if the OpenGL thread is paused properly (as in using lock/unlock) there are places where it still throws an exception (seemingly) because it requires the work be done in the OpenGL thread?  Is there any way to fix this or are we bound to having to execute it in the same thread?  If this is the case my cool lock/unlock methods are much less useful. :frowning:

I'm not quite sure what your question is. But locking (along with stopping the update calls), just creates a display list for the object. Calling this display list for rendering needs to be done in the OpenGL thread.

I guess my real question is, is there a way to change the OpenGL thread or to do that work outside of the OpenGL thread if the OpenGL thread is stopped?

darkfrog said:

I guess my real question is, is there a way to change the OpenGL thread or to do that work outside of the OpenGL thread if the OpenGL thread is stopped?


how do you want to do work with the opengl thread if the opengl thread is stopped?  :|

You didn't read my question very well. :o

sure i did. but i was drunk. sorry :slight_smile:

mojomonk said:

I'm not quite sure what your question is. But locking (along with stopping the update calls), just creates a display list for the object. Calling this display list for rendering needs to be done in the OpenGL thread.


I think he's talking about locking the thread rather than the scenegraph locks?

Essentially I'm just trying to figure out a way that I can make the lock() / unlock() methods in StandardGame useful in all circumstances.  I still get exceptions thrown from OpenGL when I try to do some work in a non-OpenGL thread even when lock is applied.  When I first wrote lock/unlock my expectation was that it really didn't matter what thread you were invoking things in, the exceptions occurred because the scenegraph was being updated at the same time a change was happening so things would get ugly.  The lock/unlock methods are used to pause the OpenGL thread at a "safe place" so you can do the work in another thread and then release the lock and let the OpenGL thread continue like nothing happened.  That works for some aspects of jME, but certain things (it would seem stuff that goes directly to OpenGL) will still throw an exception because it knows that the thread invoking it is not the OpenGL thread.



My question is, is there any way to make it so I can do this work in another thread?  Like, when lock() is called can I tell LWJGL that the OpenGL thread has changed to the thread that invoked lock() and then when unlock() is called I can put it back to StandardGame's thread?