Browse Source

Fixes a minor threading problem and removes useless imports

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9896 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
jul..om 13 years ago
parent
commit
b76bffcd2f

+ 0 - 5
engine/src/jogl/com/jme3/renderer/jogl/JoglRenderer.java

@@ -61,8 +61,6 @@ import com.jme3.texture.Image;
 import com.jme3.texture.Texture;
 import com.jme3.texture.Texture.WrapAxis;
 import com.jme3.util.BufferUtils;
-import com.jme3.util.IntMap;
-import com.jme3.util.IntMap.Entry;
 import com.jme3.util.ListMap;
 import com.jme3.util.NativeObjectManager;
 import com.jme3.util.SafeArrayList;
@@ -73,12 +71,9 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.media.opengl.GL;
 import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES1;
 import javax.media.opengl.GL2ES2;
 import javax.media.opengl.GL2GL3;
 import javax.media.opengl.GLContext;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
 import jme3tools.converters.MipMapGenerator;
 import jme3tools.shader.ShaderDebug;
 

+ 18 - 14
engine/src/jogl/com/jme3/system/jogl/JoglDisplay.java

@@ -272,26 +272,30 @@ public class JoglDisplay extends JoglAbstractDisplay {
     }
 
     public void create(boolean waitFor){
-        try {
-            if (waitFor){
-                try{
-                    SwingUtilities.invokeAndWait(new Runnable() {
+        if (SwingUtilities.isEventDispatchThread()) {
+            initInEDT();
+        } else {
+            try {
+                if (waitFor) {
+                    try {
+                        SwingUtilities.invokeAndWait(new Runnable() {
+                            public void run() {
+                                initInEDT();
+                            }
+                        });
+                    } catch (InterruptedException ex) {
+                        listener.handleError("Interrupted", ex);
+                    }
+                } else {
+                    SwingUtilities.invokeLater(new Runnable() {
                         public void run() {
                             initInEDT();
                         }
                     });
-                } catch (InterruptedException ex) {
-                    listener.handleError("Interrupted", ex);
                 }
-            }else{
-                SwingUtilities.invokeLater(new Runnable() {
-                    public void run() {
-                        initInEDT();
-                    }
-                });
+            } catch (InvocationTargetException ex) {
+                throw new AssertionError(); // can never happen
             }
-        } catch (InvocationTargetException ex) {
-            throw new AssertionError(); // can never happen
         }
     }