diff options
author | Sven Gothel <[email protected]> | 2014-02-28 15:35:17 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-02-28 15:35:17 +0100 |
commit | 4701edd64be6a7c4e57d176344fb29ee71699744 (patch) | |
tree | 88e6fff6ee2823387e70646d0e5bf2f646438359 /src/test | |
parent | af621a92250681a83e76293e7d33f685a0fc07e6 (diff) |
Bug 801: TextRenderUtil/TextRendererGLELBase - Pass Font and fontSize to all methods ; TestTextRendererNEWT00 make font/fontSize configurable, animate fontSize
Diffstat (limited to 'src/test')
8 files changed, 124 insertions, 82 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 90e81af27..2278447b9 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -43,7 +43,6 @@ import javax.media.opengl.GLProfile; import javax.media.opengl.GLRunnable; import org.junit.Assert; -import org.junit.BeforeClass; import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @@ -51,9 +50,9 @@ import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; 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.opengl.GLWindow; +import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLReadBufferUtil; @@ -67,15 +66,14 @@ public class TestTextRendererNEWT00 extends UITestCase { static long duration = 100; // ms static boolean waitStartEnd = false; static int msaaSamples = 4; + static int swapInterval = 0; static final int[] texSize = new int[] { 0 }; - static int fontSize = 18; - static Font font; - @BeforeClass - public static void setup() throws IOException { - font = FontFactory.get(FontFactory.UBUNTU).getDefault(); - } + static int fontSet = 0; + static int fontFamily = 0; + static int fontStylebits = 0; + static float fontSizeFixed = 18f; static int atoi(String a) { try { @@ -88,17 +86,31 @@ public class TestTextRendererNEWT00 extends UITestCase { if(args[i].equals("-time")) { i++; duration = atoi(args[i]); + } else if(args[i].equals("-fontSet")) { + i++; + fontSet = atoi(args[i]); + } else if(args[i].equals("-fontFamily")) { + i++; + fontFamily = atoi(args[i]); + } else if(args[i].equals("-fontStyle")) { + i++; + fontStylebits = atoi(args[i]); } else if(args[i].equals("-fontSize")) { i++; - fontSize = atoi(args[i]); + fontSizeFixed = atoi(args[i]); } else if(args[i].equals("-msaa")) { i++; msaaSamples = atoi(args[i]); + } else if(args[i].equals("-vsync")) { + i++; + swapInterval = MiscUtils.atoi(args[i], swapInterval); } else if(args[i].equals("-wait")) { waitStartEnd = true; } } + System.err.println("Font [set "+fontSet+", family "+fontFamily+", style "+fontStylebits+", size "+fontSizeFixed+"]"); System.err.println("msaaSamples "+msaaSamples); + System.err.println("swapInterval "+swapInterval); String tstname = TestTextRendererNEWT00.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -191,25 +203,31 @@ public class TestTextRendererNEWT00 extends UITestCase { private final class TextRendererGLEL extends TextRendererGLELBase { private final GLReadBufferUtil screenshot; private long t0; + final Font font = getFont(fontSet, fontFamily, fontStylebits); + final float fontSizeMin, fontSizeMax; + float fontSizeAnim, fontSizeDelta; TextRendererGLEL(final RenderState rs) { super(rs, true /* exclusivePMV */, 0); // Region.VBAA_RENDERING_BIT); texSizeScale = 2; - fontSize = TestTextRendererNEWT00.fontSize; - staticRGBAColor[0] = 0.0f; staticRGBAColor[1] = 0.0f; staticRGBAColor[2] = 0.0f; staticRGBAColor[3] = 1.0f; this.screenshot = new GLReadBufferUtil(false, false); + // fontSizeMin = Math.max(8, fontSizeFixed-5); + fontSizeMin = fontSizeFixed; + fontSizeMax = fontSizeFixed+8; + fontSizeAnim = fontSizeFixed; + fontSizeDelta = 0.01f; } @Override public void init(GLAutoDrawable drawable) { super.init(drawable); - drawable.getGL().setSwapInterval(0); + drawable.getGL().setSwapInterval(swapInterval); t0 = Platform.currentTimeMillis(); } public void dispose(GLAutoDrawable drawable) { @@ -221,7 +239,7 @@ public class TestTextRendererNEWT00 extends UITestCase { public void printScreen(GLAutoDrawable drawable, String dir, String objName, boolean exportAlpha) throws GLException, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - pw.printf("%s-msaa%02d-fontsz%02d-%03dx%03d-T%04d", objName, msaaSamples, fontSize, drawable.getWidth(), drawable.getHeight(), texSize[0]); + pw.printf("%s-msaa%02d-fontsz%02.1f-%03dx%03d-T%04d", objName, msaaSamples, TestTextRendererNEWT00.fontSizeFixed, drawable.getWidth(), drawable.getHeight(), texSize[0]); final String filename = dir + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { @@ -232,7 +250,10 @@ public class TestTextRendererNEWT00 extends UITestCase { String getFontInfo() { final float unitsPerEM_Inv = font.getMetrics().getScale(1f); final float unitsPerEM = 1f / unitsPerEM_Inv; - return String.format("Font %s, unitsPerEM %f", font.getName(Font.NAME_UNIQUNAME), unitsPerEM); + return String.format("Font %s%n %s%nunitsPerEM %f", + font.getFullFamilyName(null).toString(), + font.getName(Font.NAME_UNIQUNAME), + unitsPerEM); } @Override @@ -250,21 +271,34 @@ public class TestTextRendererNEWT00 extends UITestCase { final long t1 = Platform.currentTimeMillis(); - final String text1 = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s", - lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0); + // final float fontSize = TestTextRendererNEWT00.fontSize; + + fontSizeAnim += fontSizeDelta; + if( fontSizeMin >= fontSizeAnim || fontSizeAnim >= fontSizeMax ) { + fontSizeDelta *= -1f; + } + + final float fontSize = fontSizeFixed; + + final String text1 = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f", + lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSize); + final String text1A = String.format("%03.1f/%03.1f fps, vsync %d, elapsed %4.1f s, fontSize %2.2f", + lfps, tfps, gl.getSwapInterval(), (t1-t0)/1000.0, fontSizeAnim); if( false ) { - renderString(drawable, textX2, 0, 0, 0, 0, -1000, false); + // renderString(drawable, font, fontSize, textX2, 0, 0, 0, 0, -1000, false); + renderString(drawable, font, fontSize, "0", 0, 0, 0, 0, -1000, true); } else { - renderString(drawable, getFontInfo(), 0, 0, 0, 0, -1000, true); - renderString(drawable, "012345678901234567890123456789", 0, 0, 0, -1000, true); - renderString(drawable, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 0, 0, 0, -1000, true); - renderString(drawable, "Hello World", 0, 0, 0, -1000, true); - renderString(drawable, "4567890123456", 4, 0, 0, -1000, true); - renderString(drawable, "I like JogAmp", 4, 0, 0, -1000, true); - renderString(drawable, "Hello World", 0, 0, 0, -1000, true); - renderString(drawable, textX2, 0, 0, 0, -1000, true); - renderString(drawable, text1, 0, 0, 0, -1000, false); // no-cache + renderString(drawable, font, fontSize, getFontInfo(), 0, 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "012345678901234567890123456789", 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "Hello World", 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "4567890123456", 4, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "I like JogAmp", 4, 0, 0, -1000, true); + renderString(drawable, font, fontSize, "Hello World", 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, textX2, 0, 0, 0, -1000, true); + renderString(drawable, font, fontSize, text1, 0, 0, 0, -1000, false); // no-cache + renderString(drawable, font, fontSizeAnim, text1A, 0, 0, 0, -1000, false); // no-cache } } }; 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 ac59eb10b..def46a899 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -192,7 +192,7 @@ public class TestTextRendererNEWT10 extends UITestCase { dy -= (int)textBox.getHeight() * ( row + 1 ); textRenderUtil.renderer.resetModelview(null); textRenderUtil.renderer.translate(gl, dx, dy, z0); - textRenderUtil.drawString3D(gl, font, text, fontSize, texSize); + textRenderUtil.drawString3D(gl, font, fontSize, text, texSize); lastRow = row; } 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 42babcf35..e6840e43d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -39,12 +39,12 @@ import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.TextRegionUtil; 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.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderState; public abstract class TextRendererGLELBase implements GLEventListener { - public final Font font; public final int usrRenderModes; protected final int[] texSize = new int[] { 0 }; @@ -64,25 +64,29 @@ public abstract class TextRendererGLELBase implements GLEventListener { protected RegionRenderer renderer = null; protected TextRegionUtil textRenderUtil = null; - /** font size in pixels, default is 24 */ - protected int fontSize = 24; /** scale pixel, default is 1f */ protected float pixelScale = 1.0f; protected int texSizeScale = 2; boolean flipVerticalInGLOrientation = false; - public TextRendererGLELBase(final int renderModes) { - usrRenderModes = renderModes; - { - Font _font = null; - try { - _font = FontFactory.get(FontFactory.UBUNTU).getDefault(); - } catch (IOException e) { - e.printStackTrace(); - } - this.font = _font; + /** + * @param fontSet e.g. default is {@link FontFactory#UBUNTU} + * @param fontFamily e.g. default is {@link FontSet#FAMILY_REGULAR} + * @param fontStylebits e.g. default is {@link FontSet#STYLE_NONE} + * @return the resulting font. + */ + public static Font getFont(final int fontSet, final int fontFamily, final int fontStylebits) { + try { + return FontFactory.get(fontSet).get(fontFamily, fontStylebits); + } catch (IOException e) { + e.printStackTrace(); } + return null; + } + + public TextRendererGLELBase(final int renderModes) { + this.usrRenderModes = renderModes; } public TextRendererGLELBase(final RenderState rs, final boolean exclusivePMVMatrix, final int renderModes) { this(renderModes); @@ -96,25 +100,21 @@ public abstract class TextRendererGLELBase implements GLEventListener { @Override public void init(GLAutoDrawable drawable) { - if( null != font ) { - if( null == this.rs ) { - exclusivePMVMatrix = null == usrPMVMatrix; - this.rs = RenderState.createRenderState(new ShaderState(), SVertex.factory(), usrPMVMatrix); - } - this.renderer = RegionRenderer.create(rs, usrRenderModes); - this.textRenderUtil = new TextRegionUtil(renderer); - if( 0 == usrRenderModes ) { - texSizeScale = 0; - } - final GL2ES2 gl = drawable.getGL().getGL2ES2(); - renderer.init(gl); - renderer.setAlpha(gl, staticRGBAColor[3]); - renderer.setColorStatic(gl, staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2]); - final ShaderState st = rs.getShaderState(); - st.useProgram(gl, false); - } else { - this.renderer = null; + if( null == this.rs ) { + exclusivePMVMatrix = null == usrPMVMatrix; + this.rs = RenderState.createRenderState(new ShaderState(), SVertex.factory(), usrPMVMatrix); + } + this.renderer = RegionRenderer.create(rs, usrRenderModes); + this.textRenderUtil = new TextRegionUtil(renderer); + if( 0 == usrRenderModes ) { + texSizeScale = 0; } + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + renderer.init(gl); + renderer.setAlpha(gl, staticRGBAColor[3]); + renderer.setColorStatic(gl, staticRGBAColor[0], staticRGBAColor[1], staticRGBAColor[2]); + final ShaderState st = rs.getShaderState(); + st.useProgram(gl, false); } @Override @@ -148,12 +148,17 @@ public abstract class TextRendererGLELBase implements GLEventListener { int lastRow = -1; - public void renderString(GLAutoDrawable drawable, String text, int column, float tx, float ty, float tz, boolean cacheRegion) { + public void renderString(GLAutoDrawable drawable, + Font font, float fontSize, String text, + int column, float tx, float ty, float tz, boolean cacheRegion) { final int row = lastRow + 1; - renderString(drawable, text, column, row, tx, ty, tz, cacheRegion); + renderString(drawable, font, fontSize, text, column, row, tx, ty, tz, cacheRegion); } - public void renderString(GLAutoDrawable drawable, String text, int column, int row, float tx, float ty, float tz, boolean cacheRegion) { + public void renderString(GLAutoDrawable drawable, + Font font, float fontSize, String text, + int column, int row, + float tx, float ty, float tz, boolean cacheRegion) { if( null != renderer ) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -190,9 +195,9 @@ public abstract class TextRendererGLELBase implements GLEventListener { } renderer.updateMatrix(gl); if( cacheRegion ) { - textRenderUtil.drawString3D(gl, font, text, fontSize, texSize); + textRenderUtil.drawString3D(gl, font, fontSize, text, texSize); } else { - TextRegionUtil.drawString3D(renderer, gl, font, text, fontSize, texSize); + TextRegionUtil.drawString3D(renderer, gl, font, fontSize, text, texSize); } st.useProgram(gl, false); gl.glDisable(GL2ES2.GL_BLEND); 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 2bd4f0019..d50a089cd 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,7 +165,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB final int fpsSp = fpsS.indexOf('.'); renderer.resetModelview(null); renderer.translate(gl, fontSizeFixed, fontSizeFixed, -6000); - TextRegionUtil.drawString3D(renderer, gl, font, fpsS.substring(0, fpsSp+2)+" fps", fontSizeFixed*3, getTexSize()); // no cache! + TextRegionUtil.drawString3D(renderer, gl, font, fontSizeFixed*3, fpsS.substring(0, fpsSp+2)+" fps", getTexSize()); // no cache! } int dx = width-(int)fontNameBox.getWidth()-2 ; @@ -173,7 +173,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB renderer.resetModelview(null); renderer.translate(gl, dx, dy, -6000); - textRenderUtil.drawString3D(gl, font, fontName, fontSizeFixed*2, getTexSize()); + textRenderUtil.drawString3D(gl, font, fontSizeFixed*2, fontName, getTexSize()); dx = 10; dy += -(int)fontNameBox.getHeight() - 10; @@ -181,7 +181,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB if(null != headtext) { renderer.resetModelview(null); renderer.translate(gl, dx, dy, -6000); - textRenderUtil.drawString3D(gl, font, headtext, fontSizeFixed*3, getTexSize()); + textRenderUtil.drawString3D(gl, font, fontSizeFixed*3, headtext, getTexSize()); } renderer.reshapePerspective(null, 45.0f, width, height, 0.1f, 7000.0f); @@ -191,9 +191,9 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB renderer.rotate(gl, getAngle(), 0, 1, 0); renderer.setColorStatic(gl, 1.0f, 0.0f, 0.0f); if(!userInput) { - textRenderUtil.drawString3D(gl, font, text2, fontSize, getTexSize()); + textRenderUtil.drawString3D(gl, font, fontSize, text2, getTexSize()); } else { - textRenderUtil.drawString3D(gl, font, userString.toString(), fontSize, getTexSize()); + textRenderUtil.drawString3D(gl, font, fontSize, userString.toString(), getTexSize()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java index 18e119441..efbb992db 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java @@ -98,7 +98,7 @@ public abstract class Label extends UIShape implements UITextShape { clearImpl(null, null); glyphRegion = GLRegion.create(renderer.getRenderModes()); TextRegionUtil.addStringToRegion(glyphRegion, renderer.getRenderState().getVertexFactory(), - font, text, size); + font, size, text); } @Override 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 910c62eae..92e4fe001 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.font.Font; import com.jogamp.opengl.test.junit.graph.TextRendererGLELBase; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -51,6 +52,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; public abstract class GLReadBuffer00Base extends UITestCase { public static class TextRendererGLEL extends TextRendererGLELBase { + final Font font = getFont(0, 0, 0); public int frameNo = 0; public int userCounter = 0; @@ -59,8 +61,6 @@ public abstract class GLReadBuffer00Base extends UITestCase { super(Region.VBAA_RENDERING_BIT); texSizeScale = 2; - fontSize = 24; - staticRGBAColor[0] = 1.0f; staticRGBAColor[1] = 1.0f; staticRGBAColor[2] = 1.0f; @@ -72,7 +72,7 @@ public abstract class GLReadBuffer00Base extends UITestCase { 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, text, 0 /* col */, 0 /* row */, 0, 0, -1, false); + renderString(drawable, font, 24f, text, 0 /* col */, 0 /* row */, 0, 0, -1, false); } 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 61c4244fb..38cc96af4 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 @@ -158,7 +158,9 @@ public class MovieCube implements GLEventListener { 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; InfoTextRendererGLELBase() { // FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO @@ -225,10 +227,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, text1, 1 /* col */, -1 /* row */, -1+z_diff, yoff1, 1f+z_diff, false); - renderString(drawable, text2, 1 /* col */, 0 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); - renderString(drawable, text3, 1 /* col */, 1 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); - renderString(drawable, text4, 1 /* col */, 2 /* row */, -1+z_diff, yoff2, 1f+z_diff, true); + 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); } } }; 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 22fa63b37..a00b5da0c 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.font.Font; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; @@ -131,13 +132,13 @@ public class MovieSimple implements GLEventListener { } private final class InfoTextRendererGLELBase extends TextRendererGLELBase { + final Font font = getFont(0, 0, 0); + final float fontSize = 18f; InfoTextRendererGLELBase() { // FIXME: Graph TextRenderer does not AA well w/o MSAA and FBO super(Region.VBAA_RENDERING_BIT); texSizeScale = 2; - fontSize = 18; - staticRGBAColor[0] = 1.0f; staticRGBAColor[1] = 1.0f; staticRGBAColor[2] = 1.0f; @@ -168,10 +169,10 @@ public class MovieSimple implements GLEventListener { mPlayer.getVID(), mPlayer.getVideoBitrate()/1000, mPlayer.getVideoCodec()); final String text4 = mPlayer.getURI().getRawPath(); if( displayOSD && null != renderer ) { - renderString(drawable, text1, 1 /* col */, 1 /* row */, 0, 0, -1, false); - renderString(drawable, text2, 1 /* col */, -4 /* row */, 0, height, -1, true); - renderString(drawable, text3, 1 /* col */, -3 /* row */, 0, height, -1, true); - renderString(drawable, text4, 1 /* col */, -2 /* row */, 0, height, -1, true); + 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); } } }; private final InfoTextRendererGLELBase textRendererGLEL = new InfoTextRendererGLELBase(); |