From 7cd27e4daf27b730908f0b929385bffc2fa3c41d Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Fri, 8 Apr 2011 17:31:17 +0300 Subject: Added getBounds impl to region, returning AABBox --- src/jogl/classes/com/jogamp/graph/curve/Region.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/jogl/classes/com/jogamp/graph/curve') diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index 051cb1c38..40161f067 100755 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -29,6 +29,7 @@ package com.jogamp.graph.curve; import java.util.ArrayList; +import com.jogamp.graph.geom.AABBox; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.Vertex; import com.jogamp.opengl.util.PMVMatrix; @@ -117,6 +118,8 @@ public interface Region { */ public void destroy(); + public AABBox getBounds(); + public boolean isFlipped(); /** Set if the y coordinate of the region should be flipped -- cgit v1.2.3 From deca38fce30548d0ee624b7c747daacafca37f24 Mon Sep 17 00:00:00 2001 From: Rami Santina Date: Fri, 8 Apr 2011 17:41:45 +0300 Subject: TextRenderer - createString exposed; Renderer - added scale(); createString function is now public to be able to create a string without initializing textRenderer. Temp change, should be cleaned up. added missing scale transformation to renderer pmvmatrix; added glyphstring.getBounds() so not to use font.getStringBounds. since it Would be a redundant call. --- src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java | 7 +++++++ src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java | 2 +- src/jogl/classes/jogamp/graph/curve/text/GlyphString.java | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src/jogl/classes/com/jogamp/graph/curve') diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java index 57eeb016f..c9661b52a 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java @@ -124,6 +124,13 @@ public abstract class Renderer { st.glUniform(gl, mgl_PMVMatrix); } } + + public void scale(GL2ES2 gl, float x, float y, float z) { + pmvMatrix.glScalef(x, y, z); + if(initialized && null != gl && st.inUse()) { + st.glUniform(gl, mgl_PMVMatrix); + } + } public void resetModelview(GL2ES2 gl) { pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java index 45f78fc23..44d9a9be3 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java @@ -49,7 +49,7 @@ public abstract class TextRenderer extends Renderer { * @param sharpness parameter for Region generation of the resulting GlyphString * @return the resulting GlyphString inclusive the generated region */ - protected GlyphString createString(GL2ES2 gl, Font font, int size, String str, float sharpness) { + public GlyphString createString(GL2ES2 gl, Font font, int size, String str, float sharpness) { AffineTransform affineTransform = new AffineTransform(pointFactory); Path2D[] paths = new Path2D[str.length()]; diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index 808e3a415..7c7bb816f 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -29,6 +29,7 @@ package jogamp.graph.curve.text; import java.util.ArrayList; +import com.jogamp.graph.geom.AABBox; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.opengl.SVertex; @@ -160,4 +161,8 @@ public class GlyphString { public void destroy(){ region.destroy(); } + + public AABBox getBounds(){ + return region.getBounds(); + } } -- cgit v1.2.3