diff options
author | Sven Gothel <[email protected]> | 2014-07-05 04:04:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-05 04:04:43 +0200 |
commit | f8f0f051604721bceaee214b8e5218fd47d2eb9e (patch) | |
tree | e9c3103498984fbc5d2f8567e88009c49e8810f7 /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | |
parent | 2293a53ba04a8cf2881e8919f8be97c16a9af336 (diff) |
Bug 1021: Make OVR access vendor agnostic: Package 'com.jogamp.opengl.util.stereo' contains all public interfaces/classes
Renamed interfaces:
CustomRendererListener -> CustomGLEventListener
StereoRendererListener -> StereoGLEventListener
New vendor agnostic 'stuff' in com.jogamp.opengl.util.stereo:
1 - StereoDeviceFactory
To create a vendor specific StereoDeviceFactory instance,
which creates the StereoDevice.
2 - StereoDevice
For vendor specific implementation.
Can create StereoDeviceRenderer.
3 - StereoDeviceRenderer
For vendor specific implementation.
4 - StereoClientRenderer
Vendor agnostic client StereoGLEventListener renderer,
using a StereoDeviceRenderer.
Now supports multiple StereoGLEventListener, via add/remove.
- MovieSBSStereo demo-able via StereoDemo01
can show SBS 3D movies.
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) { |