diff options
10 files changed, 76 insertions, 27 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 8848d5d68..8e282d0dd 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -113,6 +113,7 @@ function jrun() { #X_ARGS="-Xrs" #X_ARGS="-Dsun.awt.disableMixing=true" + #D_ARGS="-Dnewt.ws.mmwidth=150 -Dnewt.ws.mmheight=90" #D_ARGS="-Djogl.debug.GLProfile -Djogl.debug.GLContext" #D_ARGS="-Dnativewindow.debug.OSXUtil.MainThreadChecker -Djogamp.common.utils.locks.Lock.timeout=600000" #D_ARGS="-Djogl.debug.GLProfile" @@ -978,8 +979,11 @@ function testawtswt() { # Linux DRM/GBM # +testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $* +#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfileXXNEWTPost $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java index 17265a6a7..b41c28e27 100644 --- a/src/newt/classes/jogamp/newt/ScreenImpl.java +++ b/src/newt/classes/jogamp/newt/ScreenImpl.java @@ -84,8 +84,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { protected int refCount; // number of Screen references by Window protected Rectangle virtViewportPU = new Rectangle(0, 0, 0, 0); // virtual rotated viewport in pixel units protected Rectangle virtViewportWU = new Rectangle(0, 0, 0, 0); // virtual rotated viewport in window units - protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight - protected static volatile boolean usrSizeQueried = false; + protected static Dimension usrScreenPixelSize = null; // property values: newt.ws.swidth and newt.ws.sheight + protected static Dimension usrMonitorMMSize = null; // property values: newt.ws.mmwidth and newt.ws.mmheight + protected static volatile boolean usrValuesQueried = false; private final ArrayList<MonitorModeListener> refMonitorModeListener = new ArrayList<MonitorModeListener>(); private long tCreated; // creationTime @@ -97,15 +98,21 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { public static Screen create(final Display display, int idx) { try { - if(!usrSizeQueried) { + if(!usrValuesQueried) { synchronized (Screen.class) { - if(!usrSizeQueried) { - usrSizeQueried = true; - final int w = PropertyAccess.getIntProperty("newt.ws.swidth", true, 0); - final int h = PropertyAccess.getIntProperty("newt.ws.sheight", true, 0); - if(w>0 && h>0) { - usrSize = new Dimension(w, h); - System.err.println("User screen size "+usrSize); + if(!usrValuesQueried) { + usrValuesQueried = true; + final int px_w = PropertyAccess.getIntProperty("newt.ws.swidth", true, 0); + final int px_h = PropertyAccess.getIntProperty("newt.ws.sheight", true, 0); + if(px_w>0 && px_h>0) { + usrScreenPixelSize = new Dimension(px_w, px_h); + System.err.println("User screen size "+usrScreenPixelSize+" [pixel]"); + } + final int mm_w = PropertyAccess.getIntProperty("newt.ws.mmwidth", true, 0); + final int mm_h = PropertyAccess.getIntProperty("newt.ws.mmheight", true, 0); + if(mm_w>0 && mm_h>0) { + usrMonitorMMSize = new Dimension(mm_w, mm_h); + System.err.println("User monitor size "+usrMonitorMMSize+" [mm]"); } } } @@ -292,9 +299,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener { * Updates the <b>rotated</b> virtual viewport, may use native impl. */ protected void updateVirtualScreenOriginAndSize() { - if(null != usrSize ) { - virtViewportPU.set(0, 0, usrSize.getWidth(), usrSize.getHeight()); - virtViewportWU.set(0, 0, usrSize.getWidth(), usrSize.getHeight()); + if(null != usrScreenPixelSize ) { + virtViewportPU.set(0, 0, usrScreenPixelSize.getWidth(), usrScreenPixelSize.getHeight()); + virtViewportWU.set(0, 0, usrScreenPixelSize.getWidth(), usrScreenPixelSize.getHeight()); if(DEBUG) { System.err.println("Update user virtual screen viewport @ "+Thread.currentThread().getName()+": "+virtViewportPU); } diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java index fbad10c8c..99609b56f 100644 --- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java @@ -107,7 +107,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - i = getScreenSizeMM(outMetrics, props, i); // sizeMM + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + i = getScreenSizeMM(outMetrics, props, i); // sizeMM + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = outMetrics.widthPixels; // rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java index 18c60ea84..69fde6736 100644 --- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java @@ -112,8 +112,13 @@ public class ScreenDriver extends ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = ScreenImpl.default_sm_widthmm; // FIXME - props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = ScreenImpl.default_sm_widthmm; // FIXME + props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = currentMode.getRotatedWidth(); // rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java index 3d2e8fc3a..3a07d38ab 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java @@ -87,8 +87,13 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = ScreenImpl.default_sm_widthmm; // FIXME - props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = ScreenImpl.default_sm_widthmm; // FIXME + props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = fixedWidth; // FIXME rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java index 6b4d97baa..a48b768c9 100644 --- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java @@ -80,8 +80,13 @@ public class ScreenDriver extends ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = ScreenImpl.default_sm_widthmm; // FIXME - props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = ScreenImpl.default_sm_widthmm; // FIXME + props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = cachedWidth; // rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java index e25a0eb22..e5ba4a960 100644 --- a/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/egl/gbm/ScreenDriver.java @@ -119,8 +119,13 @@ public class ScreenDriver extends ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = connectors[scridx].getMmWidth(); - props[i++] = connectors[scridx].getMmHeight(); + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = connectors[scridx].getMmWidth(); + props[i++] = connectors[scridx].getMmHeight(); + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = mode[scridx].getHdisplay(); // rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java index 456545430..2b5e672ed 100644 --- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java @@ -89,8 +89,13 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = ScreenImpl.default_sm_widthmm; // FIXME - props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = ScreenImpl.default_sm_widthmm; // FIXME + props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = cachedWidth; // rotated viewport width pixel-units diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java index 0b70737ac..011bfaf6e 100644 --- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java +++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java @@ -85,8 +85,13 @@ public class ScreenDriver extends ScreenImpl { props[i++] = crt_id; props[i++] = 0; // is-clone props[i++] = 1; // is-primary - props[i++] = ScreenImpl.default_sm_widthmm; // FIXME - props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + if( null != usrMonitorMMSize ) { + props[i++] = usrMonitorMMSize.getWidth(); + props[i++] = usrMonitorMMSize.getHeight(); + } else { + props[i++] = ScreenImpl.default_sm_widthmm; // FIXME + props[i++] = ScreenImpl.default_sm_heightmm; // FIXME + } props[i++] = 0; // rotated viewport x pixel-units props[i++] = 0; // rotated viewport y pixel-units props[i++] = cachedWidth; // rotated viewport width pixel-units diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java index 0c22ac43a..889f92a69 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java @@ -41,6 +41,7 @@ import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; import com.jogamp.graph.geom.SVertex; +import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.WindowAdapter; @@ -158,6 +159,8 @@ public class GPUTextNewtDemo { System.err.println("GPU Text Newt Demo: "+font2.fullString()); System.err.println("GPU Text Newt Demo: screen-dpi: "+sDPI[0]+"x"+sDPI[1]+", font "+font_ptpi+" pt, "+font_ppi+" pixel"); System.err.println("GPU Text Newt Demo: textX2: "+fontNameBox+" em, "+fontNameBox.scale(font_ppi, new float[3])+" px"); + final MonitorDevice monitor = window.getMainMonitor(); + System.err.println("GPU Text Newt Demo: "+monitor); // window.setSurfaceSize((int)(fontNameBox.getWidth()*1.1f), (int)(fontNameBox.getHeight()*2f)); } |