diff options
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index aea9a5b7b..e3ce7001e 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -649,8 +649,10 @@ public class GLDrawableHelper { public final void display(final GLAutoDrawable drawable) { displayImpl(drawable); + // runForAllGLEventListener(drawable, displayAction); if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0 displayImpl(drawable); + // runForAllGLEventListener(drawable, displayAction); } } private final void displayImpl(final GLAutoDrawable drawable) { @@ -669,6 +671,31 @@ public class GLDrawableHelper { } } + public static interface GLEventListenerAction { + public void run(final GLAutoDrawable drawable, final GLEventListener listener); + } + /** + private static GLEventListenerAction displayAction = new GLEventListenerAction() { + public void run(final GLAutoDrawable drawable, final GLEventListener listener) { + listener.display(drawable); + } }; */ + + public final void runForAllGLEventListener(final GLAutoDrawable drawable, final GLEventListenerAction action) { + synchronized(listenersLock) { + final ArrayList<GLEventListener> _listeners = listeners; + final int listenerCount = _listeners.size(); + for (int i=0; i < listenerCount; i++) { + final GLEventListener listener = _listeners.get(i) ; + // GLEventListener may need to be init, + // in case this one is added after the realization of the GLAutoDrawable + if( listenersToBeInit.remove(listener) ) { + init( listener, drawable, true /* sendReshape */, listenersToBeInit.size() + 1 == listenerCount /* setViewport if 1st init */ ); + } + action.run(drawable, listener); + } + } + } + private final void reshape(final GLEventListener listener, final GLAutoDrawable drawable, final int x, final int y, final int width, final int height, final boolean setViewport, final boolean checkInit) { if(checkInit) { |