@@ -229,8 +229,8 @@ protected void initDisplay() {
229229 screen = NewtFactory .createScreen (display , 0 );
230230 screen .addReference ();
231231
232- GraphicsEnvironment environment = GraphicsEnvironment .getLocalGraphicsEnvironment ();
233- GraphicsDevice [] awtDevices = environment .getScreenDevices ();
232+ GraphicsEnvironment ge = GraphicsEnvironment .getLocalGraphicsEnvironment ();
233+ GraphicsDevice [] awtDevices = ge .getScreenDevices ();
234234
235235 GraphicsDevice awtDisplayDevice = null ;
236236 int displayNum = sketch .sketchDisplay ();
@@ -249,7 +249,7 @@ protected void initDisplay() {
249249 }
250250
251251 if (awtDisplayDevice == null ) {
252- awtDisplayDevice = GraphicsEnvironment . getLocalGraphicsEnvironment () .getDefaultScreenDevice ();
252+ awtDisplayDevice = ge .getDefaultScreenDevice ();
253253 }
254254
255255 GraphicsConfiguration config = awtDisplayDevice .getDefaultConfiguration ();
@@ -258,7 +258,6 @@ protected void initDisplay() {
258258
259259
260260 protected void initGL () {
261- // System.out.println("*******************************");
262261 if (profile == null ) {
263262 if (PJOGL .profile == 1 ) {
264263 try {
@@ -336,13 +335,15 @@ protected void initWindow() {
336335// window = GLWindow.create(displayDevice.getScreen(), pgl.getCaps());
337336// }
338337
339- windowScaleFactor = PApplet . platform == PConstants . MACOS ?
340- 1 : sketch .pixelDensity ;
338+ windowScaleFactor =
339+ ( PApplet . platform == PConstants . MACOS ) ? 1 : sketch .pixelDensity ;
341340
342341 boolean spanDisplays = sketch .sketchDisplay () == PConstants .SPAN ;
343342 screenRect = spanDisplays ?
344- new Rectangle (screen .getX (), screen .getY (), screen .getWidth (), screen .getHeight ()) :
345- new Rectangle ((int ) displayRect .getX (), (int ) displayRect .getY (),
343+ new Rectangle (screen .getX (), screen .getY (),
344+ screen .getWidth (), screen .getHeight ()) :
345+ new Rectangle ((int ) displayRect .getX (),
346+ (int ) displayRect .getY (),
346347 (int ) displayRect .getWidth (),
347348 (int ) displayRect .getHeight ());
348349
@@ -399,19 +400,15 @@ protected void initWindow() {
399400
400401 sketch .setSize (sketchWidth , sketchHeight );
401402
402- float [] reqSurfacePixelScale ;
403- if (graphics .is2X () && PApplet .platform == PConstants .MACOS ) {
404- // Retina
405- reqSurfacePixelScale = new float [] { ScalableSurface .AUTOMAX_PIXELSCALE ,
406- ScalableSurface .AUTOMAX_PIXELSCALE };
407- } else {
408- // Non-retina
409- reqSurfacePixelScale = new float [] { ScalableSurface .IDENTITY_PIXELSCALE ,
410- ScalableSurface .IDENTITY_PIXELSCALE };
411- }
412- window .setSurfaceScale (reqSurfacePixelScale );
403+ // https://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/newt/opengl/GLWindow.html#setSurfaceScale(float%5B%5D)
404+ float surfaceScale =
405+ (graphics .is2X () && PApplet .platform == PConstants .MACOS ) ?
406+ ScalableSurface .AUTOMAX_PIXELSCALE :
407+ ScalableSurface .IDENTITY_PIXELSCALE ;
408+ window .setSurfaceScale (new float [] { surfaceScale , surfaceScale });
409+
413410 window .setSize (sketchWidth * windowScaleFactor , sketchHeight * windowScaleFactor );
414- window .setResizable (false );
411+ window .setResizable (true );
415412 setSize (sketchWidth , sketchHeight );
416413 if (fullScreen ) {
417414 PApplet .hideMenuBar ();
@@ -863,6 +860,7 @@ public float getPixelScale() {
863860 return 2 ;
864861 }
865862
863+
866864 private float getCurrentPixelScale () {
867865 // Even if the graphics are retina, the user might have moved the window
868866 // into a non-retina monitor, so we need to check
@@ -960,9 +958,11 @@ public void display(GLAutoDrawable drawable) {
960958 sketch .exitActual ();
961959 }
962960 }
961+
963962 public void dispose (GLAutoDrawable drawable ) {
964963// sketch.dispose();
965964 }
965+
966966 public void init (GLAutoDrawable drawable ) {
967967 pgl .getGL (drawable );
968968 pgl .init (drawable );
0 commit comments