pixelDensity (OpenGL): fix running 1x on 2x screen on Mac

This commit is contained in:
Jakub Valtar
2017-04-14 19:15:19 +02:00
parent 8fa6187d49
commit 6d5cc7a326
+10 -5
View File
@@ -779,15 +779,19 @@ public class PSurfaceJOGL implements PSurface {
}
if (PApplet.platform == PConstants.MACOSX) {
// Even if the graphics are retina, the user might have moved the window
// into a non-retina monitor, so we need to check
window.getCurrentSurfaceScale(currentPixelScale);
return currentPixelScale[0];
return getCurrentPixelScale();
}
return 2;
}
private float getCurrentPixelScale() {
// Even if the graphics are retina, the user might have moved the window
// into a non-retina monitor, so we need to check
window.getCurrentSurfaceScale(currentPixelScale);
return currentPixelScale[0];
}
public Component getComponent() {
return canvas;
@@ -890,7 +894,8 @@ public class PSurfaceJOGL implements PSurface {
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
pgl.resetFBOLayer();
pgl.getGL(drawable);
float scale = getPixelScale();
float scale = PApplet.platform == PConstants.MACOSX ?
getCurrentPixelScale() : getPixelScale();
setSize((int) (w / scale), (int) (h / scale));
}
}