From ec5724493bb9398134553a7354e08497e778a9cb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 25 Mar 2014 15:49:42 +0100 Subject: Bug 801: Use allsamples 'brute force' for VBAA (best quality) ; Demos: Reduce text contrast by 1/10th allowing better AA ; GPUUISceneGLListener0A uses proportional window height font size and one label w/ 10pt --- .../test/junit/graph/TestTextRendererNEWT00.java | 54 +++++++++-------- .../test/junit/graph/TestTextRendererNEWT01.java | 2 +- .../test/junit/graph/TestTextRendererNEWT10.java | 2 +- .../junit/graph/demos/GPUTextGLListener0A.java | 2 +- .../graph/demos/GPUTextRendererListenerBase01.java | 4 +- .../junit/graph/demos/GPUUISceneGLListener0A.java | 68 +++++++++++++++------- .../test/junit/jogl/acore/GLReadBuffer00Base.java | 6 +- .../test/junit/jogl/demos/es2/av/MovieCube.java | 6 +- .../test/junit/jogl/demos/es2/av/MovieSimple.java | 6 +- 9 files changed, 91 insertions(+), 59 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java index d7696f36b..d00e1c5ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -70,9 +70,10 @@ public class TestTextRendererNEWT00 extends UITestCase { static long Duration = 2000; // ms static boolean WaitStartEnd = false; static boolean TextAnim = false; - static int SceneMSAASamples = 4; - static int GraphVBAASamples = 4; - static int GraphMSAASamples = 4; + static int SceneMSAASamples = 0; + static int GraphVBAASamples = 0; + static int GraphMSAASamples = 0; + static boolean ManualTest = false; static int SwapInterval = 0; static String fontFileName = null; @@ -88,6 +89,7 @@ public class TestTextRendererNEWT00 extends UITestCase { } public static void main(String args[]) throws IOException { + ManualTest = args.length > 0; for(int i=0; i 0 ) { - testImpl(SceneMSAASamples, 0, 0); + public void test01SceneMSAA04() throws InterruptedException { + if( !ManualTest ) { + testImpl(4, 0, 0); } } @Test - public void test02GraphMSAA01() throws InterruptedException { - if( GraphMSAASamples > 0 ) { - testImpl(0, GraphMSAASamples, 0); + public void test02GraphMSAA04() throws InterruptedException { + if( !ManualTest ) { + testImpl(0, 4, 0); } } @Test - public void test03GraphVBAA01() throws InterruptedException { - if( GraphVBAASamples > 0 ) { - testImpl(0, 0, GraphVBAASamples); + public void test03GraphVBAA04() throws InterruptedException { + if( !ManualTest ) { + testImpl(0, 0, 4); } } @@ -286,9 +290,9 @@ public class TestTextRendererNEWT00 extends UITestCase { font = getFont(fontSet, fontFamily, fontStylebits); } - staticRGBAColor[0] = 0.0f; - staticRGBAColor[1] = 0.0f; - staticRGBAColor[2] = 0.0f; + staticRGBAColor[0] = 0.1f; + staticRGBAColor[1] = 0.1f; + staticRGBAColor[2] = 0.1f; staticRGBAColor[3] = 1.0f; this.screenshot = new GLReadBufferUtil(false, false); @@ -377,9 +381,9 @@ public class TestTextRendererNEWT00 extends UITestCase { lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeAnim, drawable.getChosenGLCapabilities().getNumSamples(), modeS, vbaaSampleCount[0]); - if( true ) { - renderString(drawable, font, pixelSize, "I - / H P 7 0", 0, 0, 0, 0, -1000f, true); - // renderString(drawable, font, pixelSize, "I/- 0", 0, 0, 0, 0, -1000f, true); + if( false ) { + // renderString(drawable, font, pixelSize, "I - / H P 7 0", 0, 0, 0, 0, -1000f, true); + renderString(drawable, font, pixelSize, "A M > } ] ", 0, 0, 0, 0, -1000f, true); // renderString(drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000, true); // renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true); // renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000f, regionFPS); // no-cache diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index a8044463d..8121fc03f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -230,7 +230,7 @@ public class TestTextRendererNEWT01 extends UITestCase { final RegionRenderer renderer = getRenderer(); renderer.setAlpha(gl, 1.0f); - renderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); + renderer.setColorStatic(gl, 0.1f, 0.1f, 0.1f); } public void display(GLAutoDrawable drawable) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index f89ce101c..a23a50db7 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -148,7 +148,7 @@ public class TestTextRendererNEWT10 extends UITestCase { gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); renderer.init(gl); renderer.setAlpha(gl, 1.0f); - renderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); + renderer.setColorStatic(gl, 0.1f, 0.1f, 0.1f); // reshape gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); 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 29b897d0e..05b833470 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 @@ -56,7 +56,7 @@ public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { gl.glEnable(GL2ES2.GL_DEPTH_TEST); gl.glEnable(GL2ES2.GL_BLEND); renderer.setAlpha(gl, 1.0f); - renderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); + renderer.setColorStatic(gl, 0.1f, 0.1f, 0.1f); } public void dispose(GLAutoDrawable drawable) { 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 0bd4d45a4..f187dcc6b 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 @@ -216,7 +216,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB final PMVMatrix pmv = renderer.getMatrix(); pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmv.glLoadIdentity(); - renderer.setColorStatic(gl, 0.0f, 0.0f, 0.0f); + renderer.setColorStatic(gl, 0.1f, 0.1f, 0.1f); if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } @@ -283,7 +283,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB pmv.glTranslatef(getXTran(), getYTran(), getZTran()); pmv.glRotatef(getAngle(), 0, 1, 0); renderer.updateMatrix(gl); - renderer.setColorStatic(gl, 1.0f, 0.0f, 0.0f); + renderer.setColorStatic(gl, 0.9f, 0.0f, 0.0f); if( renderer.getRenderState().isHintMaskSet(RenderState.BITHINT_BLENDING_ENABLED) ) { gl.glClearColor(1.0f, 0.0f, 0.0f, 0.0f); } 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 f22a5c56c..b6936dc0e 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 @@ -19,6 +19,7 @@ import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.geom.SVertex; +import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.Window; import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.event.MouseAdapter; @@ -54,8 +55,11 @@ public class GPUUISceneGLListener0A implements GLEventListener { final float buttonXSize = 84f; final float buttonYSize = buttonXSize/2.5f; - final float fontSizeFixed = 12f; - final float fontSizeFPS = 10f; + final float fontSizePt = 10f; + /** Proportional Window Height Font Size for Main Text, per-vertical-pixels [PVP] */ + final float fontSizeFixedPVP = 0.046f; + /** Proportional Window Height Font Size for FPS Status Line, per-vertical-pixels [PVP] */ + final float fontSizeFpsPVP = 0.038f; float dpiH = 96; private int currentText = 0; @@ -64,6 +68,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { private Label[] labels = null; private String[] strings = null; private final List buttons = new ArrayList(); + private Label truePtSizeLabel = null; private Label jogampLabel = null; private Label fpsLabel = null; private CrossHair crossHairCtr = null; @@ -74,6 +79,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { private final GLReadBufferUtil screenshot; private final String jogamp = "JogAmp - Jogl Graph Module Demo"; + private final String truePtSize = fontSizePt+" pt font size label - true scale!"; public GPUUISceneGLListener0A() { this(0); @@ -430,10 +436,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { "\n"+ "- Mouse Drag On Object\n"+ " - Click on Object and drag mouse\n"+ - " - Notice current postion in status line at buttom\n"+ + " - Notice current postion in status line at bottom\n"+ "\n"+ - "- Tilt Button Rotate Whole Button Group\n"+ - "- Window Resize Shall Maintain Layout\n"; + "- Tilt Button Rotate Whole Button Group\n"; strings[i++] = "abcdefghijklmn\nopqrstuvwxyz\n"+ "ABCDEFGHIJKL\n"+ @@ -443,13 +448,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { strings[i++] = "The quick brown fox\njumps over the lazy\ndog"; strings[i++] = - "Lorem ipsum dolor sit amet, consectetur\n"+ - "Ut purus odio, rhoncus sit amet com\n"+ - "quam iaculis urna cursus ornare. Nullam\n"+ - "In hac habitasse platea dictumst. Vivam\n"+ - "Morbi quis bibendum nibh. Donec lectus\n"+ - "Donec ut dolor et nulla tristique variu\n"+ - "in lorem. Maecenas in ipsum ac justo sc\n"; + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec \n"+ + "Ut purus odio, rhoncus sit amet commodo eget, ullamcorper vel\n"+ + "quam iaculis urna cursus ornare. Nullam ut felis a ante ultrices\n"+ + "In hac habitasse platea dictumst. Vivamus et mi a quam lacinia\n"+ + "Morbi quis bibendum nibh. Donec lectus orci, sagittis in consequat\n"+ + "Donec ut dolor et nulla tristique varius. In nulla magna, fermentum\n"+ + "in lorem. Maecenas in ipsum ac justo scelerisque sollicitudin.\n"; labels = new Label[i]; } @@ -462,8 +467,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { final Object upObj = drawable.getUpstreamWidget(); if( upObj instanceof Window ) { final float[] pixelsPerMM = new float[2]; - ((Window)upObj).getMainMonitor().getPixelsPerMM(pixelsPerMM); + final MonitorDevice mm = ((Window)upObj).getMainMonitor(); + mm.getPixelsPerMM(pixelsPerMM); dpiH = pixelsPerMM[1]*25.4f; + System.err.println("Monitor detected: "+mm); + System.err.println("Using monitor's DPI of "+(pixelsPerMM[0]*25.4f)+" x "+dpiH+" -> "+dpiH); + } else { + System.err.println("Using default DPI of "+dpiH); } if(drawable instanceof GLWindow) { System.err.println("GPUUISceneGLListener0A: init (1)"); @@ -503,22 +513,37 @@ public class GPUUISceneGLListener0A implements GLEventListener { sceneUIController.setRenderer(renderer); - final float pixelSizeFixed = font.getPixelSize(fontSizeFixed, dpiH); + final float pixelSizeFixed = fontSizeFixedPVP * drawable.getHeight(); jogampLabel = new Label(SVertex.factory(), font, pixelSizeFixed, jogamp); jogampLabel.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(jogampLabel); jogampLabel.setEnabled(enableOthers); - final float pixelSizeFPS = font.getPixelSize(fontSizeFPS, dpiH); + final float pixelSize10Pt = font.getPixelSize(fontSizePt, dpiH); + System.err.println("10Pt PixelSize: Display "+dpiH+" dpi, fontSize "+fontSizePt+" ppi -> "+pixelSize10Pt+" pixel-size"); + truePtSizeLabel = new Label(SVertex.factory(), font, pixelSize10Pt, truePtSize); + sceneUIController.addShape(truePtSizeLabel); + truePtSizeLabel.setEnabled(enableOthers); + truePtSizeLabel.translate(0, - 1.5f * jogampLabel.getLineHeight(), 0f); + truePtSizeLabel.setColor(0.1f, 0.1f, 0.1f); + + /** + * + * [Label] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 18.814816 + * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 + */ + final float pixelSizeFPS = fontSizeFpsPVP * drawable.getHeight(); fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), font, pixelSizeFPS, "Nothing there yet"); fpsLabel.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(fpsLabel); fpsLabel.setEnabled(enableOthers); + fpsLabel.setColor(0.3f, 0.3f, 0.3f); crossHairCtr = new CrossHair(renderer.getRenderState().getVertexFactory(), 100f, 100f, 2f); crossHairCtr.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(crossHairCtr); crossHairCtr.setEnabled(true); + crossHairCtr.translate(0f, 0f, -1f); initButtons(gl, renderer); for(int i=0; i