aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-03-02 00:19:35 +0100
committerSven Gothel <[email protected]>2014-03-02 00:19:35 +0100
commit7b1a0c17fe5471557ab5e0db0334bed34edb553a (patch)
treec6242b548f4f9cbe2411c8cb4bc6dd6924437e8b /src/test/com
parentc1218a7bcf42ae64b41e3d30bb1ee39c44b20a9f (diff)
Bug 801: Add MSAA_RENDERING_BIT ; VBAA: Uses GL_NEAREST (good result) ; Demos: Use local GLRegion for uncached text (perf.) ..
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java94
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java96
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java45
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java29
11 files changed, 238 insertions, 63 deletions
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 0377739fe..0a1fa7ec9 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
@@ -41,8 +41,8 @@ import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
import org.junit.Assert;
-import org.junit.Test;
import org.junit.FixMethodOrder;
+import org.junit.Test;
import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
@@ -69,8 +69,9 @@ public class TestTextRendererNEWT00 extends UITestCase {
static long Duration = 2000; // ms
static boolean WaitStartEnd = false;
static boolean TextAnim = false;
- static int MSAASamples = 4;
- static int VBAASamples = 4;
+ static int SceneMSAASamples = 4;
+ static int GraphVBAASamples = 4;
+ static int GraphMSAASamples = 4;
static int SwapInterval = 0;
static String fontFileName = null;
@@ -105,14 +106,21 @@ public class TestTextRendererNEWT00 extends UITestCase {
} else if(args[i].equals("-fontSize")) {
i++;
fontSizeFixed = atoi(args[i]);
- } else if(args[i].equals("-msaa")) {
+ } else if(args[i].equals("-smsaa")) {
+ i++;
+ SceneMSAASamples = atoi(args[i]);
+ GraphMSAASamples = 0;
+ GraphVBAASamples = 0;
+ } else if(args[i].equals("-gmsaa")) {
i++;
- MSAASamples = atoi(args[i]);
- VBAASamples = 0;
- } else if(args[i].equals("-vbaa")) {
+ SceneMSAASamples = 0;
+ GraphMSAASamples = atoi(args[i]);
+ GraphVBAASamples = 0;
+ } else if(args[i].equals("-gvbaa")) {
i++;
- VBAASamples = atoi(args[i]);
- MSAASamples = 0;
+ SceneMSAASamples = 0;
+ GraphMSAASamples = 0;
+ GraphVBAASamples = atoi(args[i]);
} else if(args[i].equals("-textAnim")) {
TextAnim = true;
} else if(args[i].equals("-vsync")) {
@@ -123,8 +131,9 @@ public class TestTextRendererNEWT00 extends UITestCase {
}
}
System.err.println("Font [set "+fontSet+", family "+fontFamily+", style "+fontStylebits+", size "+fontSizeFixed+"], fontFileName "+fontFileName);
- System.err.println("msaaSamples "+MSAASamples);
- System.err.println("vbaaSamples "+VBAASamples);
+ System.err.println("Scene MSAA Samples "+SceneMSAASamples);
+ System.err.println("Graph MSAA Samples "+GraphMSAASamples);
+ System.err.println("Graph VBAA Samples "+GraphVBAASamples);
System.err.println("swapInterval "+SwapInterval);
String tstname = TestTextRendererNEWT00.class.getName();
org.junit.runner.JUnitCore.main(tstname);
@@ -157,29 +166,35 @@ public class TestTextRendererNEWT00 extends UITestCase {
}
@Test
- public void testTextRendererMSAA01() throws InterruptedException {
- if( MSAASamples > 0 ) {
- testTextRendererImpl(MSAASamples, 0);
+ public void test01SceneMSAA01() throws InterruptedException {
+ if( SceneMSAASamples > 0 ) {
+ testImpl(SceneMSAASamples, 0, 0);
}
}
@Test
- public void testTextRendererVBAA01() throws InterruptedException {
- if( VBAASamples > 0 ) {
- testTextRendererImpl(0, VBAASamples);
+ public void test02GraphMSAA01() throws InterruptedException {
+ if( GraphMSAASamples > 0 ) {
+ testImpl(0, GraphMSAASamples, 0);
+ }
+ }
+ @Test
+ public void test03GraphVBAA01() throws InterruptedException {
+ if( GraphVBAASamples > 0 ) {
+ testImpl(0, 0, GraphVBAASamples);
}
}
- public void testTextRendererImpl(final int msaaSamples, final int vbaaSampleCount) throws InterruptedException {
+ public void testImpl(final int sceneMSAASamples, final int graphMSAASamples, final int graphVBAASamples) throws InterruptedException {
GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
GLCapabilities caps = new GLCapabilities(glp);
caps.setAlphaBits(4);
- if( 0 < msaaSamples ) {
+ if( 0 < sceneMSAASamples ) {
caps.setSampleBuffers(true);
- caps.setNumSamples(msaaSamples);
+ caps.setNumSamples(sceneMSAASamples);
}
- System.err.println("Requested: "+caps+", vbaaSamples "+vbaaSampleCount);
+ System.err.println("Requested: "+caps+", graph[msaaSamples "+graphMSAASamples+", vbaaSamples "+graphVBAASamples+"]");
- GLWindow window = createWindow("text-vbaa"+vbaaSampleCount+"-msaa"+msaaSamples, caps, 1024, 640);
+ GLWindow window = createWindow("text-gvbaa"+graphVBAASamples+"-gmsaa"+graphMSAASamples+"-smsaa"+sceneMSAASamples, caps, 1024, 640);
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
if( WaitStartEnd ) {
@@ -187,7 +202,18 @@ public class TestTextRendererNEWT00 extends UITestCase {
}
final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
- final TextRendererGLEL textGLListener = new TextRendererGLEL(rs, vbaaSampleCount>0 ? Region.VBAA_RENDERING_BIT:0, vbaaSampleCount);
+ final int rendererMode, sampleCount;
+ if( graphVBAASamples > 0 ) {
+ rendererMode = Region.VBAA_RENDERING_BIT;
+ sampleCount = graphVBAASamples;
+ } else if ( graphMSAASamples > 0 ) {
+ rendererMode = Region.MSAA_RENDERING_BIT;
+ sampleCount = graphMSAASamples;
+ } else {
+ rendererMode = 0;
+ sampleCount = 0;
+ }
+ final TextRendererGLEL textGLListener = new TextRendererGLEL(rs, rendererMode, sampleCount);
System.err.println(textGLListener.getFontInfo());
window.addGLEventListener(textGLListener);
@@ -280,6 +306,8 @@ public class TestTextRendererNEWT00 extends UITestCase {
System.err.println(getFontInfo());
System.err.println("fontSize "+fontSizeFixed+", dotsPerMM "+pixelsPerMM[0]+"x"+pixelsPerMM[1]+", dpi "+dotsPerInch[0]+"x"+dotsPerInch[1]+", pixelSize "+font.getPixelSize(fontSizeFixed, dotsPerInch[1] /* dpi display */));
}
+
+ @Override
public void dispose(GLAutoDrawable drawable) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
screenshot.dispose(gl);
@@ -289,9 +317,10 @@ public class TestTextRendererNEWT00 extends UITestCase {
}
public void printScreen(GLAutoDrawable drawable, String dir, String objName, boolean exportAlpha) throws GLException, IOException {
- final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-T%04d", objName,
+ final String modeS = Region.getRenderModeString(renderer.getRenderModes());
+ final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
drawable.getChosenGLCapabilities().getNumSamples(),
- TestTextRendererNEWT00.fontSizeFixed, drawable.getWidth(), drawable.getHeight(), vbaaSampleCount[0]);
+ TestTextRendererNEWT00.fontSizeFixed, drawable.getWidth(), drawable.getHeight(), modeS, vbaaSampleCount[0]);
final String filename = dir + bname +".png";
if(screenshot.readPixels(drawable.getGL(), false)) {
screenshot.write(new File(filename));
@@ -332,17 +361,18 @@ public class TestTextRendererNEWT00 extends UITestCase {
final float pixelSize = font.getPixelSize(fontSizeFixed, dpiH);
final float pixelSizeAnim = font.getPixelSize(fontSizeAnim, dpiH);
- final String text1 = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f, msaa %d, vba-samples %d",
+ final String modeS = Region.getRenderModeString(renderer.getRenderModes());
+ final String text1 = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f, msaa %d, %s-samples %d",
lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeFixed,
- drawable.getChosenGLCapabilities().getNumSamples(), vbaaSampleCount[0]);
- final String text1A = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f, msaa %d, vba-samples %d",
+ drawable.getChosenGLCapabilities().getNumSamples(), modeS, vbaaSampleCount[0]);
+ final String text1A = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f, msaa %d, %s-samples %d",
lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeAnim,
- drawable.getChosenGLCapabilities().getNumSamples(), vbaaSampleCount[0]);
+ drawable.getChosenGLCapabilities().getNumSamples(), modeS, vbaaSampleCount[0]);
if( false ) {
- renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000f, true);
- renderString(drawable, font, pixelSize, textX2, 0, 0, 0, -1000f, true);
- renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000f, false); // no-cache
+ // renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000f, true);
+ renderString(drawable, font, pixelSize, textX2, 0, 0, 0, 0, -1000f, true);
+ // renderString(drawable, font, pixelSize, text1, 0, 0, 0, -1000f, regionFPS); // no-cache
} else {
renderString(drawable, font, pixelSize, getFontInfo(), 0, 0, 0, 0, -1000, true);
renderString(drawable, font, pixelSize, "012345678901234567890123456789", 0, 0, 0, -1000, true);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
index d002de5e9..075d8c5e8 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
@@ -42,6 +42,7 @@ import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.font.FontSet;
import com.jogamp.graph.geom.SVertex;
+import com.jogamp.newt.Window;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -68,6 +69,9 @@ public abstract class TextRendererGLELBase implements GLEventListener {
/** scale pixel, default is 1f */
protected float pixelScale = 1.0f;
+ /** dpi display resolution, queried at {@link #init(GLAutoDrawable)} if NEWT, otherwise 96. */
+ protected float dpiH = 96;
+
boolean flipVerticalInGLOrientation = false;
/**
@@ -126,6 +130,13 @@ public abstract class TextRendererGLELBase implements GLEventListener {
renderer.setColorStatic(gl, staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2]);
final ShaderState st = rs.getShaderState();
st.useProgram(gl, false);
+
+ final Object upObj = drawable.getUpstreamWidget();
+ if( upObj instanceof Window ) {
+ final float[] pixelsPerMM = new float[2];
+ ((Window)upObj).getMainMonitor().getPixelsPerMM(pixelsPerMM);
+ dpiH = pixelsPerMM[1]*25.4f;
+ }
}
@Override
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 8520b6dfd..701a6fd92 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
@@ -285,7 +285,8 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
@Override
public boolean run(GLAutoDrawable drawable) {
try {
- final String type = Region.isVBAA(renderModes) ? "vbaa0-msaa1" : "vbaa1-msaa0" + ( Region.isNonUniformWeight(renderModes) ? "-vc" : "-uc" ) ;
+ final String modeS = Region.getRenderModeString(renderer.getRenderModes());
+ final String type = modeS + ( Region.isNonUniformWeight(renderModes) ? "-vc" : "-uc" ) ;
printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false);
screenshot_num++;
} catch (GLException e) {
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
index 3253b3bc2..d39a80eb9 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
@@ -56,7 +56,7 @@ public class GPUTextNewtDemo01 {
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 01 - vbaa0 msaa1");
+ window.setTitle("GPU Text Newt Demo 01 - smsaa1");
final RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, 0, 0, DEBUG, TRACE);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
index 7b8839d29..25635314f 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
@@ -66,7 +66,7 @@ public class GPUTextNewtDemo02 {
window.setPosition(10, 10);
window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 02 - vbaa1 msaa0");
+ window.setTitle("GPU Text Newt Demo 02 - gvbaa4 gmsaa0");
RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.VBAA_RENDERING_BIT, 4, DEBUG, TRACE);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java
new file mode 100644
index 000000000..97334311a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo03.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.junit.graph.demos;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.graph.geom.SVertex;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.glsl.ShaderState;
+
+public class GPUTextNewtDemo03 {
+ /**
+ * FIXME:
+ *
+ * If DEBUG is enabled:
+ *
+ * Caused by: javax.media.opengl.GLException: Thread[main-Display-X11_:0.0-1-EDT-1,5,main] glGetError() returned the following error codes after a call to glFramebufferRenderbuffer(<int> 0x8D40, <int> 0x1902, <int> 0x8D41, <int> 0x1): GL_INVALID_ENUM ( 1280 0x500),
+ * at javax.media.opengl.DebugGL4bc.checkGLGetError(DebugGL4bc.java:33961)
+ * at javax.media.opengl.DebugGL4bc.glFramebufferRenderbuffer(DebugGL4bc.java:33077)
+ * at jogamp.graph.curve.opengl.VBORegion2PGL3.initFBOTexture(VBORegion2PGL3.java:295)
+ */
+ static final boolean DEBUG = false;
+ static final boolean TRACE = false;
+
+ public static void main(String[] args) {
+ GLProfile glp = GLProfile.getGL2ES2();
+
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(4);
+ System.out.println("Requested: "+caps);
+
+ final GLWindow window = GLWindow.create(caps);
+
+ window.setPosition(10, 10);
+ window.setSize(800, 400);
+ window.setTitle("GPU Text Newt Demo 02 - gvbaa0 gmsaa4");
+
+ RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
+ GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, Region.MSAA_RENDERING_BIT, 4, DEBUG, TRACE);
+ // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32);
+ window.addGLEventListener(textGLListener);
+ window.setVisible(true);
+ // FPSAnimator animator = new FPSAnimator(60);
+ final Animator animator = new Animator();
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.add(window);
+
+ window.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent arg0) {
+ if(arg0.getKeyCode() == KeyEvent.VK_F4) {
+ window.destroy();
+ }
+ }
+ });
+ window.addWindowListener(new WindowAdapter() {
+ public void windowDestroyed(WindowEvent e) {
+ animator.stop();
+ }
+ });
+
+ animator.start();
+ }
+}
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 3126517d3..e5eca2360 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
@@ -35,6 +35,7 @@ import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
+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;
@@ -203,8 +204,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
tfps = 0f;
td = 0f;
}
- final String text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize [head %.1f, bottom %.1f], sampleCount %d, td %4.1f",
- lfps, tfps, gl.getSwapInterval(), fontSizeHead, fontSizeBottom, getSampleCount()[0], td);
+ final String modeS = Region.getRenderModeString(renderer.getRenderModes());
+ final String text = String.format("%03.1f/%03.1f fps, v-sync %d, fontSize [head %.1f, bottom %.1f], %s-samples %d, td %4.1f",
+ lfps, tfps, gl.getSwapInterval(), fontSizeHead, fontSizeBottom, modeS, getSampleCount()[0], td);
renderer.resetModelview(null);
renderer.translate(gl, 0, pixelSizeFPS/2, -6000); // bottom, half line up
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 5de2e95a7..1a81204d6 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
@@ -77,7 +77,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
public GPUUISceneGLListener0A(RenderState rs, int renderModes, boolean debug, boolean trace) {
this.rs = rs;
this.renderModes = renderModes;
- this.sampleCount[0] = Region.isVBAA(renderModes) ? 4 : 0;
+ this.sampleCount[0] = 4;
this.renderModes2 = 0;
this.texSize2[0] = 0;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java
index c8e2acef3..8c4cfd4b3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java
@@ -41,6 +41,7 @@ import org.junit.Test;
import org.junit.runners.MethodSorters;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.Font;
import com.jogamp.opengl.test.junit.graph.TextRendererGLELBase;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -55,10 +56,12 @@ public abstract class GLReadBuffer00Base extends UITestCase {
final Font font = getFont(0, 0, 0);
public int frameNo = 0;
public int userCounter = 0;
+ private final GLRegion regionFPS;
public TextRendererGLEL() {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
super(Region.VBAA_RENDERING_BIT, new int[] { 4 });
+ regionFPS = GLRegion.create(usrRenderModes);
staticRGBAColor[0] = 1.0f;
staticRGBAColor[1] = 1.0f;
@@ -67,11 +70,17 @@ public abstract class GLReadBuffer00Base extends UITestCase {
}
@Override
+ public void dispose(GLAutoDrawable drawable) {
+ regionFPS.destroy(drawable.getGL().getGL2ES2(), renderer);
+ super.dispose(drawable);
+ }
+
+ @Override
public void display(GLAutoDrawable drawable) {
final String text = String.format("Frame %04d (%03d): %04dx%04d", frameNo, userCounter, drawable.getWidth(), drawable.getHeight());
System.err.println("TextRendererGLEL.display: "+text);
if( null != renderer ) {
- renderString(drawable, font, 24f, text, 0 /* col */, 0 /* row */, 0, 0, -1, false);
+ renderString(drawable, font, 24f, text, 0 /* col */, 0 /* row */, 0, 0, -1, regionFPS);
} else {
System.err.println(text);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
index d2f2edec6..bc3786b81 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
@@ -43,6 +43,7 @@ import javax.media.opengl.GLProfile;
import com.jogamp.common.util.IOUtil;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.Font;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
@@ -159,24 +160,17 @@ public class MovieCube implements GLEventListener {
final int[] textSampleCount = { 4 };
private final class InfoTextRendererGLELBase extends TextRendererGLELBase {
- static final float z_diff = 0.001f;
- final Font font = getFont(0, 0, 0);
- final float underlineSize;
- final float fontSize;
+ private static final float z_diff = 0.001f;
+ private final Font font = getFont(0, 0, 0);
+ private final float fontSize = 12;
+ private final GLRegion regionFPS;
+ private float pixelSize, underlineSize;
InfoTextRendererGLELBase() {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
super(Region.VBAA_RENDERING_BIT, MovieCube.this.textSampleCount);
-
- fontSize = 1;
- pixelScale = 1.0f / ( fontSize * 20f );
-
- // underlineSize: 'underline' amount of pixel below 0/0 (Note: lineGap is negative)
- final Font.Metrics metrics = font.getMetrics();
- final float lineGap = metrics.getLineGap(fontSize);
- final float descent = metrics.getDescent(fontSize);
- underlineSize = descent - lineGap;
- // System.err.println("XXX: fLG "+lineGap+", fDesc "+descent+", underlineSize "+underlineSize);
+ regionFPS = GLRegion.create(usrRenderModes);
+ System.err.println("RegionFPS "+Region.getRenderModeString(usrRenderModes)+", sampleCount "+textSampleCount[0]+", class "+regionFPS.getClass().getName());
staticRGBAColor[0] = 0.0f;
staticRGBAColor[1] = 0.0f;
@@ -189,6 +183,21 @@ public class MovieCube implements GLEventListener {
// non-exclusive mode!
this.usrPMVMatrix = cube.pmvMatrix;
super.init(drawable);
+
+ pixelSize = font.getPixelSize(fontSize, dpiH);
+ pixelScale = 1.0f / ( pixelSize * 20f );
+ // underlineSize: 'underline' amount of pixel below 0/0 (Note: lineGap is negative)
+ final Font.Metrics metrics = font.getMetrics();
+ final float lineGap = metrics.getLineGap(pixelSize);
+ final float descent = metrics.getDescent(pixelSize);
+ underlineSize = descent - lineGap;
+ System.err.println("XXX: dpiH "+dpiH+", fontSize "+fontSize+", pixelSize "+pixelSize+", pixelScale "+pixelScale+", fLG "+lineGap+", fDesc "+descent+", underlineSize "+underlineSize);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ regionFPS.destroy(drawable.getGL().getGL2ES2(), renderer);
+ super.dispose(drawable);
}
@Override
@@ -228,10 +237,10 @@ public class MovieCube implements GLEventListener {
mPlayer.getVID(), mPlayer.getVideoBitrate()/1000, mPlayer.getVideoCodec());
final String text4 = mPlayer.getURI().getRawPath();
if( displayOSD && null != renderer ) {
- renderString(drawable, font, fontSize, text1, 1 /* col */, -1 /* row */, -1+z_diff, yoff1, 1f+z_diff, false);
- renderString(drawable, font, fontSize, text2, 1 /* col */, 0 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
- renderString(drawable, font, fontSize, text3, 1 /* col */, 1 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
- renderString(drawable, font, fontSize, text4, 1 /* col */, 2 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
+ renderString(drawable, font, pixelSize, text1, 1 /* col */, -1 /* row */, -1+z_diff, yoff1, 1f+z_diff, regionFPS); // no-cache
+ renderString(drawable, font, pixelSize, text2, 1 /* col */, 0 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
+ renderString(drawable, font, pixelSize, text3, 1 /* col */, 1 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
+ renderString(drawable, font, pixelSize, text4, 1 /* col */, 2 /* row */, -1+z_diff, yoff2, 1f+z_diff, true);
}
} };
private final InfoTextRendererGLELBase textRendererGLEL = new InfoTextRendererGLELBase();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index 5c8a62b14..ab159fb85 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -49,6 +49,7 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IOUtil;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.font.Font;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
@@ -134,11 +135,15 @@ public class MovieSimple implements GLEventListener {
final int[] textSampleCount = { 4 };
private final class InfoTextRendererGLELBase extends TextRendererGLELBase {
- final Font font = getFont(0, 0, 0);
- final float fontSize = 18f;
+ private final Font font = getFont(0, 0, 0);
+ private final float fontSize = 12f;
+ private final GLRegion regionFPS;
+
InfoTextRendererGLELBase() {
// FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO
super(Region.VBAA_RENDERING_BIT, textSampleCount);
+ regionFPS = GLRegion.create(usrRenderModes);
+ System.err.println("RegionFPS "+Region.getRenderModeString(usrRenderModes)+", sampleCount "+textSampleCount[0]+", class "+regionFPS.getClass().getName());
staticRGBAColor[0] = 1.0f;
staticRGBAColor[1] = 1.0f;
@@ -147,6 +152,17 @@ public class MovieSimple implements GLEventListener {
}
@Override
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ regionFPS.destroy(drawable.getGL().getGL2ES2(), renderer);
+ super.dispose(drawable);
+ }
+
+ @Override
public void display(GLAutoDrawable drawable) {
final GLAnimatorControl anim = drawable.getAnimator();
final float lfps = null != anim ? anim.getLastFPS() : 0f;
@@ -170,10 +186,11 @@ public class MovieSimple implements GLEventListener {
mPlayer.getVID(), mPlayer.getVideoBitrate()/1000, mPlayer.getVideoCodec());
final String text4 = mPlayer.getURI().getRawPath();
if( displayOSD && null != renderer ) {
- renderString(drawable, font, fontSize, text1, 1 /* col */, 1 /* row */, 0, 0, -1, false);
- renderString(drawable, font, fontSize, text2, 1 /* col */, -4 /* row */, 0, height, -1, true);
- renderString(drawable, font, fontSize, text3, 1 /* col */, -3 /* row */, 0, height, -1, true);
- renderString(drawable, font, fontSize, text4, 1 /* col */, -2 /* row */, 0, height, -1, true);
+ final float pixelSize = font.getPixelSize(fontSize, dpiH);
+ renderString(drawable, font, pixelSize, text1, 1 /* col */, 1 /* row */, 0, 0, -1, regionFPS); // no-cache
+ renderString(drawable, font, pixelSize, text2, 1 /* col */, -4 /* row */, 0, height, -1, true);
+ renderString(drawable, font, pixelSize, text3, 1 /* col */, -3 /* row */, 0, height, -1, true);
+ renderString(drawable, font, pixelSize, text4, 1 /* col */, -2 /* row */, 0, height, -1, true);
}
} };
private final InfoTextRendererGLELBase textRendererGLEL = new InfoTextRendererGLELBase();