aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-jogl/src/main/java/com/ardor3d
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-03-05 21:04:53 +0100
committerJulien Gouesse <[email protected]>2013-03-05 21:04:53 +0100
commita2c14b1c244dad36fcb61bde4853d313383aa88e (patch)
treec859d7c0bb2d339bee4f0a913c892f1c54c7fda8 /ardor3d-jogl/src/main/java/com/ardor3d
parent49807120feb0c7bc22b5db5f4f6a43852e0bacbb (diff)
Removes the previous fix from JoglNewtAwtCanvas
Diffstat (limited to 'ardor3d-jogl/src/main/java/com/ardor3d')
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtCanvas.java36
-rw-r--r--ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtInitializerRunnable.java42
2 files changed, 11 insertions, 67 deletions
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 dea1317..5f3ffbe 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
@@ -10,10 +10,10 @@
package com.ardor3d.framework.jogl;
-import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.CountDownLatch;
-import javax.swing.SwingUtilities;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLRunnable;
import com.ardor3d.annotation.MainThread;
import com.ardor3d.framework.Canvas;
@@ -32,12 +32,9 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind
private final JoglDrawerRunnable _drawerGLRunnable;
- private final JoglNewtAwtInitializerRunnable _initializerRunnable;
-
public JoglNewtAwtCanvas(final DisplaySettings settings, final JoglCanvasRenderer canvasRenderer) {
super(GLWindow.create(CapsUtil.getCapsForSettings(settings)));
_drawerGLRunnable = new JoglDrawerRunnable(canvasRenderer);
- _initializerRunnable = new JoglNewtAwtInitializerRunnable(this, settings);
getNewtWindow().setUndecorated(true);
_settings = settings;
_canvasRenderer = canvasRenderer;
@@ -55,32 +52,21 @@ public class JoglNewtAwtCanvas extends NewtCanvasAWT implements Canvas, NewtWind
}
// Make the window visible to realize the OpenGL surface.
- // setVisible(true);
+ setVisible(true);
// Request the focus here as it cannot work when the window is not visible
- // requestFocus();
+ requestFocus();
/**
* I do not understand why I cannot get the context earlier, I failed in getting it from addNotify() and
* setVisible(true)
* */
- /*
- * _canvasRenderer.setContext(getNewtWindow().getContext());
- *
- * getNewtWindow().invoke(true, new GLRunnable() {
- *
- * @Override public boolean run(final GLAutoDrawable glAutoDrawable) { _canvasRenderer.init(_settings, true);//
- * true - do swap in renderer. return true; } });
- */
- if (!SwingUtilities.isEventDispatchThread()) {
- try {
- SwingUtilities.invokeAndWait(_initializerRunnable);
- } catch (final InterruptedException ex) {
- ex.printStackTrace();
- } catch (final InvocationTargetException ex) {
- ex.printStackTrace();
+ _canvasRenderer.setContext(getNewtWindow().getContext());
+ getNewtWindow().invoke(true, new GLRunnable() {
+ @Override
+ public boolean run(final GLAutoDrawable glAutoDrawable) {
+ _canvasRenderer.init(_settings, true);// true - do swap in renderer.
+ return true;
}
- } else {
- _initializerRunnable.run();
- }
+ });
_inited = true;
}
diff --git a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtInitializerRunnable.java b/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtInitializerRunnable.java
deleted file mode 100644
index 71080f2..0000000
--- a/ardor3d-jogl/src/main/java/com/ardor3d/framework/jogl/JoglNewtAwtInitializerRunnable.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright (c) 2008-2010 Ardor Labs, Inc.
- *
- * This file is part of Ardor3D.
- *
- * Ardor3D is free software: you can redistribute it and/or modify it
- * under the terms of its license which may be found in the accompanying
- * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
- */
-
-package com.ardor3d.framework.jogl;
-
-import com.ardor3d.framework.DisplaySettings;
-
-public class JoglNewtAwtInitializerRunnable implements Runnable {
-
- private final JoglNewtAwtCanvas _joglNewtAwtCanvas;
-
- private final DisplaySettings _settings;
-
- public JoglNewtAwtInitializerRunnable(final JoglNewtAwtCanvas joglAwtCanvas, final DisplaySettings settings) {
- _joglNewtAwtCanvas = joglAwtCanvas;
- _settings = settings;
- }
-
- @Override
- public void run() {
- // Make the window visible to realize the OpenGL surface.
- _joglNewtAwtCanvas.setVisible(true);
- // Force the realization
- _joglNewtAwtCanvas.getNewtWindow().display();
- if (!_joglNewtAwtCanvas.getNewtWindow().getDelegatedDrawable().isRealized()) {
- throw new RuntimeException("The heavyweight AWT drawable cannot be realized");
- }
- // Request the focus here as it cannot work when the window is not visible
- _joglNewtAwtCanvas.requestFocus();
- // The OpenGL context has been created after the realization of the surface
- _joglNewtAwtCanvas.getCanvasRenderer().setContext(_joglNewtAwtCanvas.getNewtWindow().getContext());
- // As the canvas renderer knows the OpenGL context, it can be initialized
- _joglNewtAwtCanvas.getCanvasRenderer().init(_settings, true);
- }
-} \ No newline at end of file