It is not clear an animator class function.
From JavaDoc: "An Animator can be attached to one or more GLAutoDrawables to drive their display() methods in a loop." It is clear, It make function calls of GLEventListener object. From JavaDoc:"The Animator class creates a background thread in which the calls to display() are performed". I make a simple test with javax.swing.SwingUtilities.isEventDispatchThread() and receive "true" in all cases. When I wrote: final GLWindow win1 = GLWindow.create(glCapabilities); newtCanvasAWT = new NewtCanvasAWT(win1); Thread glEventListenerImpl = new Thread(new Runnable() { public void run() { win1.addGLEventListener( new GLEventListenerImpl()); } }); glEventListenerImpl.start(); I interesting in one question: Can I suppose that GLEventListener object functions calls will be safe (thread-safe). I mean that can case occur when animator makes a display() call earlier, than previous call would be finished or any other different cases. |
Administrator
|
On Saturday, March 26, 2011 16:31:53 Itun [via jogamp] wrote:
> > It is not clear an animator class function. > >From JavaDoc: "An Animator can be attached to one or more GLAutoDrawables to > drive their display() methods in a loop." > It is clear, It make function calls of GLEventListener object. > >From JavaDoc:"The Animator class creates a background thread in which the > calls to display() are performed". > I make a simple test with javax.swing.SwingUtilities.isEventDispatchThread() > and receive "true" in all cases. > When I wrote: > final GLWindow win1 = GLWindow.create(glCapabilities); > newtCanvasAWT = new NewtCanvasAWT(win1); > Thread glEventListenerImpl = new Thread(new Runnable() { > > public void run() { > win1.addGLEventListener( > new GLEventListenerImpl()); > } > }); > glEventListenerImpl.start(); don't get your test .. looks like a burner / load test ? > I interesting in one question: Can I suppose that GLEventListener object > functions calls will be safe (thread-safe). I mean that can case occur when > animator makes a display() call earlier, than previous call would be > finished or any other different cases. our GLAutoDrawables (animator is linked back to it) check if such is attached and running, where display() is skipped for these (GLCanvas, GLWindow). however, display is blocking .. so should be fine. ~Sven |
I am sorry for a such tangled post, I was hurry.
I used GLCanvas. I have pasted javax.swing.SwingUtilities.isEventDispatchThread() at the display() function, which had returned "true". But animator must create a new thread for GLEventListener. Now I am using GLWindow and it return me "false". |
Administrator
|
On Saturday, March 26, 2011 22:10:47 Itun [via jogamp] wrote:
> > I am sorry for a such tangled post, I was hurry. > I used GLCanvas. I have pasted > javax.swing.SwingUtilities.isEventDispatchThread() at the display() > function, which had returned "true". But animator must create a new thread > for GLEventListener. > Now I am using GLWindow and it return me "false". yup. AWT GLCanvas must render on the AWT EDT even if kicked off by a 3rd animation thread. NEWT can do it's job on the animation thread and hence doesn't get saturated in such way. ~Sven |
Free forum by Nabble | Edit this page |