summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-12-22 02:28:39 +0100
committerSven Gothel <[email protected]>2010-12-22 02:28:39 +0100
commit1c2a11a54949188d6704558f7fa38ecf8e811118 (patch)
tree21f27dbb5e98add4a42833bc26e64ad62830e612 /src/jogl/classes
parent2ddefbe9d2d99960042e9c2b3327952af112560b (diff)
Always issue GLEventListener's initialization, if provoked by ctx creation
Diffstat (limited to 'src/jogl/classes')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
index 5dae257ed..4aae89bcf 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
@@ -103,6 +103,8 @@ public class GLDrawableHelper {
if(0>index) {
index = listeners.size();
}
+ // GLEventListener may be added after context is created,
+ // hence we earmark initialization for the next display call.
listenersToBeInit.add(listener);
if(!listenersIter) {
// fast path
@@ -142,7 +144,6 @@ public class GLDrawableHelper {
for (int i=0; i < listeners.size(); i++) {
GLEventListener listener = (GLEventListener) listeners.get(i) ;
listener.dispose(drawable);
- listenersToBeInit.add(listener);
}
listenersIter = false;
}
@@ -164,6 +165,12 @@ public class GLDrawableHelper {
listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
GLEventListener listener = (GLEventListener) listeners.get(i) ;
+
+ // If make current ctx, invoked by invokGL(..), results in a new ctx, init gets called.
+ // This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window),
+ // hence the must always be initialized unconditional.
+ listenersToBeInit.add(listener);
+
if ( ! init( listener, drawable, false ) ) {
throw new GLException("GLEventListener "+listener+" already initialized: "+drawable);
}