aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main/java/com
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-03-09 11:46:24 +0100
committerJulien Gouesse <[email protected]>2013-03-09 11:46:24 +0100
commit7b20617dbfa5ffa549cd164a895353545949f58e (patch)
tree11061e455152cff1b7be074752c2b4bb6b7d0c60 /ardor3d-jogl/src/main/java/com
parent2492056ee157259337bbdf1c0a6bee30f436f93e (diff)
Doesn't assume that the drawable is realized
Diffstat (limited to 'ardor3d-jogl/src/main/java/com')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglInitializerRunnable.java15
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java2
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java2
4 files changed, 10 insertions, 11 deletions
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
index 58fef71..36cc77e 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglAwtCanvas.java
@@ -71,7 +71,7 @@ public class JoglAwtCanvas extends GLCanvas implements Canvas {
_initializerRunnable.run();
}
- _inited = true;
+ _inited = isRealized();
}
public void draw(final CountDownLatch latch) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglInitializerRunnable.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglInitializerRunnable.java
index 2a93f38..8e621f7 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglInitializerRunnable.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglInitializerRunnable.java
@@ -29,14 +29,13 @@ public class JoglInitializerRunnable implements Runnable {
_joglAwtCanvas.setVisible(true);
// Force the realization
_joglAwtCanvas.display();
- if (!_joglAwtCanvas.getDelegatedDrawable().isRealized()) {
- throw new RuntimeException("The heavyweight AWT drawable cannot be realized");
+ if (_joglAwtCanvas.getDelegatedDrawable().isRealized()) {
+ // Request the focus here as it cannot work when the window is not visible
+ _joglAwtCanvas.requestFocus();
+ // The OpenGL context has been created after the realization of the surface
+ _joglAwtCanvas.getCanvasRenderer().setContext(_joglAwtCanvas.getContext());
+ // As the canvas renderer knows the OpenGL context, it can be initialized
+ _joglAwtCanvas.getCanvasRenderer().init(_settings, true);
}
- // Request the focus here as it cannot work when the window is not visible
- _joglAwtCanvas.requestFocus();
- // The OpenGL context has been created after the realization of the surface
- _joglAwtCanvas.getCanvasRenderer().setContext(_joglAwtCanvas.getContext());
- // As the canvas renderer knows the OpenGL context, it can be initialized
- _joglAwtCanvas.getCanvasRenderer().init(_settings, true);
}
} \ No newline at end of file
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
index 5f3ffbe..c164eef 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java
@@ -68,7 +68,7 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind
}
});
- _inited = true;
+ _inited = getNewtWindow().isRealized();
}
public void draw(final CountDownLatch latch) {
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
index 9490dea..9117eea 100644
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
+++ b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtWindow.java
@@ -179,7 +179,7 @@ public class JoglNewtWindow implements NativeCanvas, NewtWindowContainer {
return true;
}
});
- _inited = true;
+ _inited = _newtWindow.isRealized();
}
public void draw(final CountDownLatch latch) {