diff options
Diffstat (limited to 'src/test/com')
7 files changed, 33 insertions, 19 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index b26ed88a8..2d3b0664e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -47,6 +47,7 @@ import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.KeyListener; import com.jogamp.newt.opengl.GLWindow; @@ -121,6 +122,17 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { @Override public void init(final GLAutoDrawable drawable) { + final Object upObj = drawable.getUpstreamWidget(); + if( upObj instanceof Window ) { + final Window window = (Window) upObj; + final float[] sDPI = window.getPixelsPerMM(new float[2]); + sDPI[0] *= 25.4f; + sDPI[1] *= 25.4f; + System.err.println("DPI "+sDPI[0]+" x "+sDPI[1]); + + final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]); + System.err.println("HiDPI PixelScale: "+hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); + } autoDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java index f7e779cd3..bf0a907b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java @@ -34,7 +34,6 @@ import com.jogamp.opengl.GLAutoDrawable; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.geom.SVertex; import com.jogamp.newt.opengl.GLWindow; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index c648708d4..945204052 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -165,9 +165,14 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB super.init(drawable); final Object upObj = drawable.getUpstreamWidget(); if( upObj instanceof Window ) { - final float[] pixelsPerMM = new float[2]; - ((Window)upObj).getPixelsPerMM(pixelsPerMM); - dpiH = pixelsPerMM[1]*25.4f; + final Window window = (Window) upObj; + final float[] sDPI = window.getPixelsPerMM(new float[2]); + sDPI[0] *= 25.4f; + sDPI[1] *= 25.4f; + dpiH = sDPI[1]; + System.err.println("Using screen DPI of "+dpiH); + } else { + System.err.println("Using default DPI of "+dpiH); } fontNameBox = font.getMetricBounds(fontName, font.getPixelSize(fontSizeFName, dpiH)); switchHeadBox(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index 3f5c5229e..33b7e2787 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -522,6 +522,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { mPlayer.setTextureUnit(texUnitMediaPlayer); final MediaPlayerButton mPlayerButton = new MediaPlayerButton(renderer.getRenderState().getVertexFactory(), renderModes, button2XSize, button2YSize, mPlayer); + mPlayerButton.setVerbose(true); mPlayerButton.addDefaultEventListener(); mPlayerButton.translate(xStartRight, yStartTop - diffY*1, 0f); mPlayerButton.setToggleable(true); @@ -666,14 +667,17 @@ public class GPUUISceneGLListener0A implements GLEventListener { if( upObj instanceof Window ) { final Window upWin = (Window)upObj; final MonitorDevice mm = upWin.getMainMonitor(); - final float[] monitorPixelsPerMM = mm.getPixelsPerMM(new float[2]); - final float monitorDpiH = monitorPixelsPerMM[1]*25.4f; - final float[] surfacePixelsPerMM = upWin.getPixelsPerMM(new float[2]); - dpiH = surfacePixelsPerMM[1]*25.4f; + final float[] monitorDPI = mm.getPixelsPerMM(new float[2]); + monitorDPI[0] *= 25.4f; + monitorDPI[1] *= 25.4f; + final float[] sDPI = upWin.getPixelsPerMM(new float[2]); + sDPI[0] *= 25.4f; + sDPI[1] *= 25.4f; + dpiH = sDPI[1]; System.err.println("Monitor detected: "+mm); - System.err.println("Monitor dpi: "+monitorDpiH); + System.err.println("Monitor dpi: "+monitorDPI[0]+" x "+monitorDPI[1]); System.err.println("Surface scale: native "+Arrays.toString(upWin.getMaximumSurfaceScale(new float[2]))+", current "+Arrays.toString(upWin.getCurrentSurfaceScale(new float[2]))); - System.err.println("Surface dpi: "+dpiH); + System.err.println("Surface dpi "+sDPI[0]+" x "+sDPI[1]); } else { System.err.println("Using default DPI of "+dpiH); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java index 8b5b70239..721fe9cb0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java @@ -180,10 +180,6 @@ public class GPUUISceneNewtCanvasAWTDemo { frame.setVisible(true); } }); - final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]); - System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ - valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ - hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); animator.start(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java index aa6dd00cc..3053ed40a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java @@ -145,10 +145,6 @@ public class GPUUISceneNewtDemo { }); window.setVisible(true); - final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]); - System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ - valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+ - hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)"); animator.start(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java index 83fc6ca95..44e2c6034 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java @@ -41,7 +41,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; * GPU based resolution independent {@link GLMediaPlayer} Button impl */ public class MediaPlayerButton extends TextureSeqButton { - public boolean verbose = false; + private boolean verbose = false; /** * @param factory @@ -62,6 +62,8 @@ public class MediaPlayerButton extends TextureSeqButton { setEnabled(false); // data and shader n/a yet } + public void setVerbose(final boolean v) { verbose = v; } + /** * Add the default {@link GLMediaEventListener} to {@link #getGLMediaPlayer() this class's GLMediaPlayer}. */ |