diff options
author | Sven Gothel <[email protected]> | 2011-12-11 05:38:12 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-11 05:38:12 +0100 |
commit | 395d572d4018ff474520b7157038d1769bff857d (patch) | |
tree | caa18bc28bebb372c0ae87ad20c1d06544597463 | |
parent | 9291731fec7103301ba36511ceb4375f63170e5c (diff) |
GLDrawableHelper.reshape(): check whether to call GLEventListener's init() hook or not
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 151ec2e9c..71eec2fbd 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -134,7 +134,7 @@ public class GLDrawableHelper { if(listenersToBeInit.remove(l)) { l.init(drawable); if(sendReshape) { - reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), true /* setViewport */); + reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), true /* setViewport */, false); } return true; } @@ -177,7 +177,12 @@ public class GLDrawableHelper { } private void reshape(GLEventListener listener, GLAutoDrawable drawable, - int x, int y, int width, int height, boolean setViewport) { + int x, int y, int width, int height, boolean setViewport, boolean checkInit) { + if(checkInit) { + // GLEventListener may need to be init, + // in case this one is added after the realization of the GLAutoDrawable + init( listener, drawable, false ) ; + } if(setViewport) { drawable.getGL().glViewport(x, y, width, height); } @@ -187,7 +192,7 @@ public class GLDrawableHelper { public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { synchronized(listenersLock) { for (int i=0; i < listeners.size(); i++) { - reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i); + reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i, true); } } } |