Login  Register

Re: Multithready between AWT and JOGL

Posted by Sven Gothel on Sep 23, 2011; 6:46am
URL: https://forum.jogamp.org/Multithready-between-AWT-and-JOGL-tp3356928p3361106.html

On Friday, September 23, 2011 04:23:20 AM millerni456 [via jogamp] wrote:

>
> Hmm... although my original problem was not lag. I do get a lot of that when
> I populate my particles objects. I tried starting a new thread that manages
> updating of the particles while the GLAutoDrawable thread renders them using
> the particles statistics.
>
> After changing to the NEWT implementation, however, I still cannot schedule
> a pick-selection. I even trying modifying the pick-Selection scheduling
> variable (boolean) inside the GLRunnable.run() method. Any Ideas?
>
> I think the problem is that I still have two threads accessing two different
> values store in the same variable. For example, the variable is true on one
> thread, but it remains false on the other.

GLRunnable, GLEventListener accessing GL and your data
  -> If you use vars from the same thread, no need to sync them.

We do exactly that in our UI demo:
  http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java;hb=HEAD#l208

  - Note we return false, which will lead to re-display the content normally.
  - Note we wait for GLRunnable to be done, hence implicit sync.

Well, I don't know your code so I don't know if you can use it this way.
Maybe you some synchronization.

Hope this helps.

~Sven