Browse Source

Fixes a bug in JoglNewtDisplay: the native counterpart of the Screen instance must have been created before retrieving or modifying the screen mode according to Sven Göthel

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10016 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
jul..om 12 năm trước cách đây
mục cha
commit
e4b80ebb0d
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      engine/src/jogl/com/jme3/system/jogl/JoglNewtDisplay.java

+ 8 - 3
engine/src/jogl/com/jme3/system/jogl/JoglNewtDisplay.java

@@ -106,14 +106,19 @@ public class JoglNewtDisplay extends JoglNewtAbstractDisplay {
         canvas.setUndecorated(settings.isFullscreen());
         canvas.setFullscreen(settings.isFullscreen());
         
-        // the canvas must be visible to allow the modification of the screen
-        //FIXME it should not be necessary
-        canvas.setVisible(true);
         /**
          * uses the filtering relying on resolution with the size to fetch only
          * the screen mode matching with the current resolution
          */
         Screen screen = canvas.getScreen();
+        /**
+         * The creation of native resources is lazy in JogAmp, i.e they are 
+         * created only when they are used for the first time. When the GLWindow
+         * is not yet visible, its screen might have been unused for now and 
+         * then its native counterpart has not yet been created. That's why 
+         * forcing the creation of this resource is necessary
+         */
+        screen.addReference();
         if (settings.isFullscreen()) {
             List<ScreenMode> screenModes = screen.getScreenModes();
             //the resolution is provided by the user