summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-04-08 18:08:56 +0200
committerSven Gothel <[email protected]>2011-04-08 18:08:56 +0200
commit547724c6790db5888bf803ec7e79b5eaa8cc1d87 (patch)
tree6d41675a8aafe6f7d2dec28ade0813f749388cc2 /src/jogl/classes
parentba47ef11171a8da45c718c89d1e962287b504e36 (diff)
parentf628fc29468b7a6b821b5a47dd93224730222dc4 (diff)
Merge remote-tracking branch 'rsantina/graph' into graph
Diffstat (limited to 'src/jogl/classes')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/graph/curve/Region.java4
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java7
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java3
-rw-r--r--src/jogl/classes/com/jogamp/graph/geom/AABBox.java8
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java4
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java25
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphString.java5
7 files changed, 44 insertions, 12 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index e238889e0..cc21af859 100755
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -29,9 +29,9 @@ package com.jogamp.graph.curve;
import java.util.ArrayList;
+import com.jogamp.graph.geom.AABBox;
import jogamp.opengl.Debug;
-import com.jogamp.graph.curve.opengl.Renderer;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
@@ -129,6 +129,8 @@ public interface Region {
*/
public void destroy();
+ public AABBox getBounds();
+
public boolean isFlipped();
/** Set if the y coordinate of the region should be flipped
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 aa14bcbd8..ce3e83692 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -125,6 +125,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 4b7299a33..ee8dfb372 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -48,11 +48,10 @@ 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) {
if(DEBUG) {
System.err.println("createString: "+getCacheSize()+"/"+getCacheLimit()+" - "+Font.NAME_UNIQUNAME + " - " + str + " - " + size);
}
-
AffineTransform affineTransform = new AffineTransform(pointFactory);
Path2D[] paths = new Path2D[str.length()];
diff --git a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
index 8cd06329e..17a805b31 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/AABBox.java
@@ -57,8 +57,8 @@ public class AABBox {
public AABBox(float lx, float ly, float lz,
float hx, float hy, float hz)
{
- setLow(lx, ly, lz);
- setHigh(hx, hy, hz);
+ resize(lx, ly, lz);
+ resize(hx, hy, hz);
computeCenter();
}
@@ -69,8 +69,8 @@ public class AABBox {
*/
public AABBox(float[] low, float[] high)
{
- this.low = low;
- this.high = high;
+ resize(low[0],low[1],low[2]);
+ resize(high[0],high[1],high[2]);
computeCenter();
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 17962a297..81d9d1858 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -354,4 +354,8 @@ public class VBORegion2PES2 implements Region {
public void setFlipped(boolean flipped) {
this.flipped = flipped;
}
+
+ public AABBox getBounds(){
+ return box;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 80bf00428..0d68be8ce 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -34,6 +34,7 @@ import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLContext;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.geom.AABBox;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -53,11 +54,14 @@ public class VBORegionSPES2 implements Region {
private boolean flipped = false;
private boolean dirty = false;
+ private AABBox box = null;
+
public VBORegionSPES2(GLContext context){
this.context =context;
}
public void update(){
+ box = new AABBox();
GL2ES2 gl = context.getGL().getGL2ES2();
destroy(gl);
@@ -96,13 +100,21 @@ public class VBORegionSPES2 implements Region {
vertices.size(), GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
verticeAttr.setLocation(Region.VERTEX_ATTR_IDX);
for(Vertex v:vertices){
- verticeAttr.putf(v.getX());
+
if(flipped){
- verticeAttr.putf(-1*v.getY());
- } else {
- verticeAttr.putf(v.getY());
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(-1*v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),-1*v.getY(),v.getZ());
+ }
+ else{
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),v.getY(),v.getZ());
}
- verticeAttr.putf(v.getZ());
}
verticeAttr.seal(gl, true);
@@ -187,4 +199,7 @@ public class VBORegionSPES2 implements Region {
public void setFlipped(boolean flipped) {
this.flipped = flipped;
}
+ public AABBox getBounds(){
+ return box;
+ }
}
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();
+ }
}