summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java44
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java86
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java77
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java13
9 files changed, 146 insertions, 104 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 7e8ed4023..0d1e87ad1 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -55,22 +55,22 @@ public class TextRegionUtil {
}
/**
- * Add the string in 3D space w.r.t. the font and pixelSize at the end of the {@link GLRegion}.
+ * Add the string in 3D space w.r.t. the font and fontSize at the end of the {@link GLRegion}.
* @param region the {@link GLRegion} sink
* @param vertexFactory vertex impl factory {@link Factory}
* @param font the target {@link Font}
+ * @param fontSize
* @param str string text
- * @param pixelSize
*/
public static void addStringToRegion(final GLRegion region, final Factory<? extends Vertex> vertexFactory,
- final Font font, final CharSequence str, final int pixelSize) {
+ final Font font, final float fontSize, final CharSequence str) {
final int charCount = str.length();
// region.setFlipped(true);
final Font.Metrics metrics = font.getMetrics();
- final float lineHeight = font.getLineHeight(pixelSize);
+ final float lineHeight = font.getLineHeight(fontSize);
- final float scale = metrics.getScale(pixelSize);
+ final float scale = metrics.getScale(fontSize);
final AffineTransform transform = new AffineTransform(vertexFactory);
final AffineTransform t = new AffineTransform(vertexFactory);
@@ -83,7 +83,7 @@ public class TextRegionUtil {
y -= lineHeight;
advanceTotal = 0;
} else if (character == ' ') {
- advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, pixelSize);
+ advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, fontSize);
} else {
if(Region.DEBUG_INSTANCE) {
System.err.println("XXXXXXXXXXXXXXx char: "+character+", scale: "+scale+"; translate: "+advanceTotal+", "+y);
@@ -99,62 +99,62 @@ public class TextRegionUtil {
}
region.addOutlineShape(glyphShape, t);
- advanceTotal += glyph.getAdvance(pixelSize, true);
+ advanceTotal += glyph.getAdvance(fontSize, true);
}
}
}
/**
- * Render the string in 3D space w.r.t. the font and pixelSize
+ * Render the string in 3D space w.r.t. the font and fontSize
* using a cached {@link GLRegion} for reuse.
* <p>
* Cached {@link GLRegion}s will be destroyed w/ {@link #clear(GL2ES2)} or to free memory.
* </p>
* @param gl the current GL state
* @param font {@link Font} to be used
+ * @param fontSize font size
* @param str text to be rendered
- * @param pixelSize font size
* @param texSize desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if TextRenderer not initialized
*/
public void drawString3D(final GL2ES2 gl,
- final Font font, final CharSequence str, final int pixelSize,
+ final Font font, final float fontSize, final CharSequence str,
final int[/*1*/] texSize) {
if( !renderer.isInitialized() ) {
throw new GLException("TextRendererImpl01: not initialized!");
}
final RenderState rs = renderer.getRenderState();
final int special = 0;
- GLRegion region = getCachedRegion(font, str, pixelSize, special);
+ GLRegion region = getCachedRegion(font, str, fontSize, special);
if(null == region) {
region = GLRegion.create(renderer.getRenderModes());
- addStringToRegion(region, rs.getVertexFactory(), font, str, pixelSize);
- addCachedRegion(gl, font, str, pixelSize, special, region);
+ addStringToRegion(region, rs.getVertexFactory(), font, fontSize, str);
+ addCachedRegion(gl, font, str, fontSize, special, region);
}
region.draw(gl, renderer, texSize);
}
/**
- * Render the string in 3D space w.r.t. the font and pixelSize
+ * Render the string in 3D space w.r.t. the font and fontSize
* using a temporary {@link GLRegion}, which will be destroyed afterwards.
* @param gl the current GL state
* @param font {@link Font} to be used
- * @param str text to be rendered
* @param fontSize font size
+ * @param str text to be rendered
* @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if TextRenderer not initialized
*/
public static void drawString3D(final RegionRenderer renderer, final GL2ES2 gl,
- final Font font, final CharSequence str, final int fontSize,
+ final Font font, final float fontSize, final CharSequence str,
final int[/*1*/] texSize) {
if(!renderer.isInitialized()){
throw new GLException("TextRendererImpl01: not initialized!");
}
final RenderState rs = renderer.getRenderState();
final GLRegion region = GLRegion.create(renderer.getRenderModes());
- addStringToRegion(region, rs.getVertexFactory(), font, str, fontSize);
+ addStringToRegion(region, rs.getVertexFactory(), font, fontSize, str);
region.draw(gl, renderer, texSize);
region.destroy(gl, renderer);
}
@@ -213,11 +213,11 @@ public class TextRegionUtil {
}
}
- protected final GLRegion getCachedRegion(Font font, CharSequence str, int fontSize, int special) {
+ protected final GLRegion getCachedRegion(Font font, CharSequence str, float fontSize, int special) {
return stringCacheMap.get(getKey(font, str, fontSize, special));
}
- protected final void addCachedRegion(GL2ES2 gl, Font font, CharSequence str, int fontSize, int special, GLRegion glyphString) {
+ protected final void addCachedRegion(GL2ES2 gl, Font font, CharSequence str, float fontSize, int special, GLRegion glyphString) {
if ( 0 != getCacheLimit() ) {
final String key = getKey(font, str, fontSize, special);
final GLRegion oldRegion = stringCacheMap.put(key, glyphString);
@@ -231,7 +231,7 @@ public class TextRegionUtil {
protected final void removeCachedRegion(GL2ES2 gl, Font font, CharSequence str, int fontSize, int special) {
final String key = getKey(font, str, fontSize, special);
- GLRegion region = stringCacheMap.remove(key);
+ final GLRegion region = stringCacheMap.remove(key);
if(null != region) {
region.destroy(gl, renderer);
}
@@ -248,10 +248,10 @@ public class TextRegionUtil {
}
}
- protected final String getKey(Font font, CharSequence str, int fontSize, int special) {
+ protected final String getKey(Font font, CharSequence str, float fontSize, int special) {
final StringBuilder sb = new StringBuilder();
return font.getName(sb, Font.NAME_UNIQUNAME)
- .append(".").append(str.hashCode()).append(".").append(fontSize).append(special).toString();
+ .append(".").append(str.hashCode()).append(".").append(Float.floatToIntBits(fontSize)).append(special).toString();
}
/** Default cache limit, see {@link #setCacheLimit(int)} */
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();