aboutsummaryrefslogtreecommitdiffstats
path: root/turtle2d/src/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'turtle2d/src/com/jogamp')
-rwxr-xr-xturtle2d/src/com/jogamp/graph/curve/OutlineShape.java307
-rwxr-xr-xturtle2d/src/com/jogamp/graph/curve/Region.java128
-rwxr-xr-xturtle2d/src/com/jogamp/graph/curve/RegionFactory.java62
-rw-r--r--turtle2d/src/com/jogamp/graph/curve/opengl/RegionRenderer.java113
-rw-r--r--turtle2d/src/com/jogamp/graph/curve/opengl/Renderer.java167
-rw-r--r--turtle2d/src/com/jogamp/graph/curve/opengl/TextRenderer.java103
-rw-r--r--turtle2d/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java216
-rw-r--r--turtle2d/src/com/jogamp/graph/font/Font.java82
-rw-r--r--turtle2d/src/com/jogamp/graph/font/FontFactory.java80
-rw-r--r--turtle2d/src/com/jogamp/graph/font/FontSet.java60
-rw-r--r--turtle2d/src/com/jogamp/graph/geom/AABBox.java299
-rw-r--r--turtle2d/src/com/jogamp/graph/geom/Outline.java176
-rw-r--r--turtle2d/src/com/jogamp/graph/geom/Triangle.java79
-rw-r--r--turtle2d/src/com/jogamp/graph/geom/Vertex.java80
-rw-r--r--turtle2d/src/com/jogamp/graph/geom/opengl/SVertex.java178
-rwxr-xr-xturtle2d/src/com/jogamp/graph/math/Quaternion.java382
-rwxr-xr-xturtle2d/src/com/jogamp/graph/math/VectorUtil.java295
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java156
-rwxr-xr-xturtle2d/src/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java169
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java124
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java120
-rwxr-xr-xturtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java75
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java75
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java52
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java264
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java61
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java67
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java76
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java229
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java69
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/ReadBufferUtil.java109
-rw-r--r--turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/Screenshot.java39
32 files changed, 0 insertions, 4492 deletions
diff --git a/turtle2d/src/com/jogamp/graph/curve/OutlineShape.java b/turtle2d/src/com/jogamp/graph/curve/OutlineShape.java
deleted file mode 100755
index 827717aa5..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/OutlineShape.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/**
- * 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.graph.curve;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-import com.jogamp.graph.geom.Outline;
-import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.math.VectorUtil;
-
-import com.jogamp.graph.curve.tess.CDTriangulator2D;
-
-/** A Generic shape objects which is defined by a list of Outlines.
- * This Shape can be transformed to Triangulations.
- * The list of triangles generated are render-able by a Region object.
- * The triangulation produced by this Shape will define the
- * closed region defined by the outlines.
- *
- * One or more OutlineShape Object can be associated to a region
- * this is left as a high-level representation of the Objects. For
- * optimizations, flexibility requirements for future features.
- *
- * <br><br>
- * Example to creating an Outline Shape:
- * <pre>
- addVertex(...)
- addVertex(...)
- addVertex(...)
- addEnptyOutline()
- addVertex(...)
- addVertex(...)
- addVertex(...)
- * </pre>
- *
- * The above will create two outlines each with three vertices. By adding these two outlines to
- * the OutlineShape, we are stating that the combination of the two outlines represent the shape.
- * <br>
- *
- * To specify that the shape is curved at a region, the on-curve flag should be set to false
- * for the vertex that is in the middle of the curved region (if the curved region is defined by 3
- * vertices (quadratic curve).
- * <br>
- * In case the curved region is defined by 4 or more vertices the middle vertices should both have
- * the on-curve flag set to false.
- *
- * <br>Example: <br>
- * <pre>
- addVertex(0,0, true);
- addVertex(0,1, false);
- addVertex(1,1, false);
- addVertex(1,0, true);
- * </pre>
- *
- * The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
- * do not belong to the final rendered shape.
- *
- * <i>Implementation Notes:</i><br>
- * <ul>
- * <li> The first vertex of any outline belonging to the shape should be on-curve</li>
- * <li> Intersections between off-curved parts of the outline is not handled</li>
- * </ul>
- *
- * @see Outline
- * @see Region
- */
-public class OutlineShape {
-
- public static final int QUADRATIC_NURBS = 10;
- private final Vertex.Factory<? extends Vertex> vertexFactory;
-
- /** The list of {@link Outline}s that are part of this
- * outline shape.
- */
- private ArrayList<Outline> outlines = new ArrayList<Outline>(3);
-
- /** Create a new Outline based Shape
- */
- public OutlineShape(Vertex.Factory<? extends Vertex> factory) {
- vertexFactory = factory;
- outlines.add(new Outline());
- }
-
- /** Returns the associated vertex factory of this outline shape
- * @return Vertex.Factory object
- */
- public final Vertex.Factory<? extends Vertex> vertexFactory() { return vertexFactory; }
-
- /** Add a new empty {@link Outline}
- * to the shape, this new outline will
- * be placed at the end of the outline list.
- *
- * After a call to this function all new vertices added
- * will belong to the new outline
- */
- public void addEmptyOutline(){
- outlines.add(new Outline());
- }
-
- /** Adds an {@link Outline} to the OutlineShape object
- * if last outline of the shape is empty, it will replace
- * that last Outline with the new one. If outline is empty,
- * it will do nothing.
- * @param outline an Outline object
- */
- public void addOutline(Outline outline){
- if(outline.isEmpty()){
- return;
- }
- if(getLastOutline().isEmpty()){
- outlines.remove(getLastOutline());
- }
- outlines.add(outline);
- }
-
- /** Adds a vertex to the last open outline in the
- * shape.
- * @param v the vertex to be added to the OutlineShape
- */
- public final void addVertex(Vertex v){
- getLastOutline().addVertex(v);
- }
-
- /** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
- * of the vertex. The 2D vertex will be represented as Z=0.
- *
- * @param x the x coordinate
- * @param y the y coordniate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float x, float y, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, x, y, onCurve);
- }
-
- /** Add a 3D {@link Vertex} to the last outline by defining the coordniate attribute
- * of the vertex.
- * @param x the x coordinate
- * @param y the y coordniate
- * @param z the z coordniate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float x, float y, float z, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, x, y, z, onCurve);
- }
-
- /** Add a vertex to the last outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
- * The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
- * are set implicitly to zero.
- * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
- * @param offset the offset in the buffer to the x coordinate
- * @param length the number of attributes to pick from the buffer (maximum 3)
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
- getLastOutline().addVertex(vertexFactory, coordsBuffer, offset, length, onCurve);
- }
-
- /** Closes the last outline in the shape
- * if last vertex is not equal to first vertex.
- * A new temp vertex is added at the end which
- * is equal to the first.
- */
- public void closeLastOutline(){
- getLastOutline().setClosed(true);
- }
-
- /** Get the last added outline to the list
- * of outlines that define the shape
- * @return the last outline
- */
- public final Outline getLastOutline(){
- return outlines.get(outlines.size()-1);
- }
- /** Make sure that the outlines represent
- * the specified destinationType, if not
- * transform outlines to destination type.
- * @param destinationType The curve type needed
- */
- public void transformOutlines(int destinationType){
- if(destinationType == QUADRATIC_NURBS){
- transformOutlinesQuadratic();
- }
- }
-
- private void transformOutlinesQuadratic(){
- ArrayList<Outline> newOutlines = new ArrayList<Outline>(3);
-
- /**loop over the outlines and make sure no
- * adj off-curve vertices
- */
- for(Outline outline:outlines){
- Outline newOutline = new Outline();
-
- ArrayList<Vertex> vertices = outline.getVertices();
- int size =vertices.size()-1;
- for(int i=0;i<size;i++){
- Vertex currentVertex = vertices.get(i);
- Vertex nextVertex = vertices.get((i+1)%size);
- if(!(currentVertex.isOnCurve()) && !(nextVertex.isOnCurve())) {
- newOutline.addVertex(currentVertex);
-
- float[] newCoords = VectorUtil.mid(currentVertex.getCoord(), nextVertex.getCoord());
- newOutline.addVertex(vertexFactory, newCoords, 0, 3, true);
- }
- else {
- newOutline.addVertex(currentVertex);
- }
- }
- newOutlines.add(newOutline);
- }
- outlines = newOutlines;
- }
-
- private void generateVertexIds(){
- int maxVertexId = 0;
- for(Outline outline:outlines){
- ArrayList<Vertex> vertices = outline.getVertices();
- for(Vertex vert:vertices){
- vert.setId(maxVertexId);
- maxVertexId++;
- }
- }
- }
-
- /** @return the list of vertices associated with the
- * {@code Outline} list of this object
- */
- public ArrayList<Vertex> getVertices(){
- ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- for(Outline polyline:outlines){
- vertices.addAll(polyline.getVertices());
- }
- return vertices;
- }
-
- /** Triangulate the outline shape generating a list of triangles
- * @return an arraylist of triangles representing the filled region
- * which is produced by the combination of the outlines
- */
- public ArrayList<Triangle> triangulate(){
- return triangulate(0.5f);
- }
-
- /**Triangulate the {@link OutlineShape} generating a list of triangles
- * @param sharpness defines the curvature strength around the off-curve vertices.
- * defaults to 0.5f
- * @return an arraylist of triangles representing the filled region
- * which is produced by the combination of the outlines
- */
- public ArrayList<Triangle> triangulate(float sharpness){
- if(outlines.size() == 0){
- return null;
- }
- sortOutlines();
- generateVertexIds();
-
- CDTriangulator2D triangulator2d = new CDTriangulator2D(sharpness);
- for(int index = 0; index< outlines.size();index++){
- Outline outline = outlines.get(index);
- triangulator2d.addCurve(outline);
- }
-
- ArrayList<Triangle> triangles = triangulator2d.generateTriangulation();
- triangulator2d.reset();
-
- return triangles;
- }
-
- /** Sort the outlines from large
- * to small depending on the AABox
- */
- private void sortOutlines() {
- Collections.sort(outlines);
- Collections.reverse(outlines);
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/curve/Region.java b/turtle2d/src/com/jogamp/graph/curve/Region.java
deleted file mode 100755
index 051cb1c38..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/Region.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.graph.curve;
-
-import java.util.ArrayList;
-
-import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.opengl.util.PMVMatrix;
-
-/** A Region is the OGL binding of one or more OutlineShapes
- * Defined by its vertices and generated triangles. The Region
- * defines the final shape of the OutlineShape(s), which shall produced a shaded
- * region on the screen.
- *
- * Implementations of the Region shall take care of the OGL
- * binding of the depending on its context, profile.
- *
- * @see RegionFactory, OutlineShape
- */
-public interface Region {
- /** The vertices index in an OGL object
- */
- public static int VERTEX_ATTR_IDX = 0;
-
- /** The Texture Coord index in an OGL object
- */
- public static int TEXCOORD_ATTR_IDX = 1;
-
- /** single pass rendering, fast, but AA might not be perfect */
- public static int SINGLE_PASS = 1;
-
- /** two pass rendering, slower and more resource hungry (FBO), but AA is perfect */
- public static int TWO_PASS = 2;
-
- /** Updates a graph region by updating the ogl related
- * objects for use in rendering. if called for the first time
- * it initialize the objects.
- */
- public void update();
-
- /** Renders the associated OGL objects specifying
- * current width/hight of window for multi pass rendering
- * of the region.
- * @param matrix current {@link PMVMatrix}.
- * @param vp_width current screen width
- * @param vp_height current screen height
- * @param width texture width for mp rendering
- *
- * @see update()
- */
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width);
-
- /** Adds a list of {@link Triangle} objects to the Region
- * These triangles are to be binded to OGL objects
- * on the next call to {@code update}
- * @param tris an arraylist of triangle objects
- *
- * @see update()
- */
- public void addTriangles(ArrayList<Triangle> tris);
-
- /** Get the current number of vertices associated
- * with this region. This number is not necessary equal to
- * the OGL binded number of vertices.
- * @return vertices count
- *
- * @see isDirty()
- */
- public int getNumVertices();
-
- /** Adds a list of {@link Vertex} objects to the Region
- * These vertices are to be binded to OGL objects
- * on the next call to {@code update}
- * @param verts an arraylist of vertex objects
- *
- * @see update()
- */
- public void addVertices(ArrayList<Vertex> verts);
-
- /** Check if this region is dirty. A region is marked dirty
- * when new Vertices, Triangles, and or Lines are added after a
- * call to update()
- * @return true if region is Dirty, false otherwise
- *
- * @see update();
- */
- public boolean isDirty();
-
- /** Delete and clean the associated OGL
- * objects
- */
- public void destroy();
-
- public boolean isFlipped();
-
- /** Set if the y coordinate of the region should be flipped
- * {@code y=-y} used mainly for fonts since they use opposite vertex
- * as origion
- * @param flipped flag if the coordinate is flipped defaults to false.
- */
- public void setFlipped(boolean flipped);
-}
diff --git a/turtle2d/src/com/jogamp/graph/curve/RegionFactory.java b/turtle2d/src/com/jogamp/graph/curve/RegionFactory.java
deleted file mode 100755
index d3b978b8a..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/RegionFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.graph.curve;
-
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-import jogamp.graph.curve.opengl.VBORegionSPES2;
-import jogamp.graph.curve.opengl.VBORegion2PES2;
-
-
-/** RegionFactory to create a Context specific Region implementation.
- *
- * @see Region
- */
-public class RegionFactory {
-
- /**Create a Region based on the GLContext attached
- * @param context the current {@link GLContext}
- * @param st the {@link ShaderState} object
- * @param type can be one of Region.SINGLE_PASS or Region.TWO_PASS
- * @return region
- */
- public static Region create(GLContext context, ShaderState st, int type){
- if( !context.isGL2ES2() ) {
- throw new GLException("At least a GL2ES2 GL context is required. Given: " + context);
- }
- if( Region.TWO_PASS == type ){
- return new VBORegion2PES2(context, st);
- }
- else{
- return new VBORegionSPES2(context);
- }
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/curve/opengl/RegionRenderer.java b/turtle2d/src/com/jogamp/graph/curve/opengl/RegionRenderer.java
deleted file mode 100644
index c1fec10b8..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package com.jogamp.graph.curve.opengl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.media.opengl.GL2ES2;
-
-import com.jogamp.graph.curve.OutlineShape;
-import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.RegionFactory;
-import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Vertex;
-
-public abstract class RegionRenderer extends Renderer {
-
- /** Create a Hardware accelerated Curve Region Renderer
- */
- public static RegionRenderer create(Vertex.Factory<? extends Vertex> factory, int type) {
- return new jogamp.graph.curve.opengl.RegionRendererImpl01(factory, type);
- }
-
- public RegionRenderer(Vertex.Factory<? extends Vertex> factory, int type) {
- super(factory, type);
- }
-
- /** Render an array of {@link OutlineShape}s combined in one region
- * at the position provided the triangles of the
- * shapes will be generated, if not yet generated
- * @param outlineShapes array of OutlineShapes to Render.
- * @param position the initial translation of the outlineShapes.
- * @param texSize texture size for multipass render *
- * @throws Exception if HwRegionRenderer not initialized
- */
- public abstract void renderOutlineShapes(GL2ES2 gl, OutlineShape[] outlineShapes, float[] position, int texSize);
-
- /** Render an {@link OutlineShape} in 3D space at the position provided
- * the triangles of the shapes will be generated, if not yet generated
- * @param outlineShape the OutlineShape to Render.
- * @param position the initial translation of the outlineShape.
- * @param texSize texture size for multipass render
- * @throws Exception if HwRegionRenderer not initialized
- */
- public abstract void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize);
-
- protected HashMap<Integer, Region> regions = new HashMap<Integer, Region>();
-
- public void flushCache() {
- Iterator<Region> iterator = regions.values().iterator();
- while(iterator.hasNext()){
- Region region = iterator.next();
- region.destroy();
- }
- regions.clear();
- }
-
- /** Create an ogl {@link Region} defining this {@link OutlineShape}
- * @param sharpness parameter for Region generation
- * @return the resulting Region.
- */
- protected Region createRegion(GL2ES2 gl, OutlineShape outlineShape, float sharpness) {
- Region region = RegionFactory.create(gl.getContext(), st, renderType);
-
- outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
-
- ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate(sharpness);
- ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
- region.addVertices(vertices);
- region.addTriangles(triangles);
-
- region.update();
- return region;
- }
-
- /** Create an ogl {@link Region} defining the list of {@link OutlineShape}.
- * Combining the Shapes into single buffers.
- * @param sharpness parameter for Region generation
- * @return the resulting Region inclusive the generated region
- */
- protected Region createRegion(GL2ES2 gl, OutlineShape[] outlineShapes, float sharpness) {
- Region region = RegionFactory.create(gl.getContext(), st, renderType);
-
- int numVertices = region.getNumVertices();
-
- for(OutlineShape outlineShape:outlineShapes){
- outlineShape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
-
- ArrayList<Triangle> triangles = outlineShape.triangulate(sharpness);
- region.addTriangles(triangles);
-
- ArrayList<Vertex> vertices = outlineShape.getVertices();
- for(Vertex vert:vertices){
- vert.setId(numVertices++);
- }
- region.addVertices(vertices);
- }
-
- region.update();
- return region;
- }
-
- protected static int getHashCode(OutlineShape outlineShape){
- return outlineShape.hashCode();
- }
-
- protected static int getHashCode(OutlineShape[] outlineShapes){
- int hashcode = 0;
- for(OutlineShape outlineShape:outlineShapes){
- hashcode += getHashCode(outlineShape);
- }
- return hashcode;
- }
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/graph/curve/opengl/Renderer.java b/turtle2d/src/com/jogamp/graph/curve/opengl/Renderer.java
deleted file mode 100644
index 863928ed4..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/opengl/Renderer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.jogamp.graph.curve.opengl;
-
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-
-import jogamp.opengl.Debug;
-
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.geom.opengl.SVertex;
-import com.jogamp.opengl.util.PMVMatrix;
-import com.jogamp.opengl.util.glsl.ShaderState;
-
-public abstract class Renderer {
- protected static final boolean DEBUG = Debug.debug("CurveRenderer");
-
- protected abstract boolean initImpl(GL2ES2 gl);
-
- protected abstract void disposeImpl(GL2ES2 gl);
-
- /**
- * Flushes all cached data
- */
- public abstract void flushCache();
-
- public abstract float getAlpha();
-
- public abstract void setAlpha(GL2ES2 gl, float alpha_t);
-
- public abstract void setColor(GL2ES2 gl, float r, float g, float b);
-
- protected final Vertex.Factory<? extends Vertex> pointFactory;
- protected ShaderState st = new ShaderState();
- protected PMVMatrix pmvMatrix = new PMVMatrix();
- protected GLUniformData mgl_PMVMatrix;
- protected int renderType;
- protected int vp_width = 0;
- protected int vp_height = 0;
-
- private boolean vboSupported = false;
- private boolean initialized = false;
-
- /**
- *
- * @param factory
- * @param renderType either {@link com.jogamp.graph.curve.Region#SINGLE_PASS} or {@link com.jogamp.graph.curve.Region#TWO_PASS}
- */
- protected Renderer(Vertex.Factory<? extends Vertex> factory, int renderType) {
- this.renderType = renderType;
- this.pointFactory = (null != factory) ? factory : SVertex.factory();
- }
-
- public Vertex.Factory<? extends Vertex> getFactory() { return pointFactory; }
-
- public final boolean isInitialized() { return initialized; }
-
- public final boolean isVBOSupported() { return vboSupported; }
-
- public final int getRenderType() { return renderType; }
-
- public final int getWidth() { return vp_width; }
- public final int getHeight() { return vp_height; }
-
- /**
- * Initialize shaders and bindings for GPU based rendering.
- * Leaves the renderer enabled, ie ShaderState on.
- *
- * @param gl the current GL state
- * @return true if succeeded, false otherwise
- */
- public boolean init(GL2ES2 gl) {
- if(initialized){
- if(DEBUG) {
- System.err.println("TextRenderer: Already initialized!");
- }
- return true;
- }
- vboSupported = gl.isFunctionAvailable("glGenBuffers") &&
- gl.isFunctionAvailable("glBindBuffer") &&
- gl.isFunctionAvailable("glBufferData") &&
- gl.isFunctionAvailable("glDrawElements") &&
- gl.isFunctionAvailable("glVertexAttribPointer") &&
- gl.isFunctionAvailable("glDeleteBuffers");
-
- if(DEBUG) {
- System.err.println("TextRendererImpl01: VBO Supported = " + isVBOSupported());
- }
-
- initialized = initImpl(gl);
- return initialized;
- }
-
- public void dispose(GL2ES2 gl) {
- if(!initialized){
- if(DEBUG) {
- System.err.println("TextRenderer: Not initialized!");
- }
- return;
- }
- disposeImpl(gl);
- st.destroy(gl);
- flushCache();
- initialized = false;
- }
-
- public final ShaderState getShaderState() { return st; }
-
- public final PMVMatrix getMatrix() { return pmvMatrix; }
-
- public void rotate(GL2ES2 gl, float angle, float x, float y, float z) {
- pmvMatrix.glRotatef(angle, x, y, z);
- if(initialized && null != gl && st.inUse()) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
- }
-
- public void translate(GL2ES2 gl, float x, float y, float z) {
- pmvMatrix.glTranslatef(x, y, z);
- if(initialized && null != gl && st.inUse()) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
- }
-
- public void resetModelview(GL2ES2 gl) {
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
- if(initialized && null != gl && st.inUse()) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
- }
-
- public void updateMatrix(GL2ES2 gl) {
- if(initialized && null != gl && st.inUse()) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
- }
-
- public boolean reshapePerspective(GL2ES2 gl, float angle, int width, int height, float near, float far) {
- this.vp_width = width;
- this.vp_height = height;
- float ratio = (float)width/(float)height;
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(angle, ratio, near, far);
-
- if(initialized && null != gl) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
-
- return true;
- }
-
- public boolean reshapeOrtho(GL2ES2 gl, int width, int height, float near, float far) {
- this.vp_width = width;
- this.vp_height = height;
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.glOrthof(0, width, 0, height, near, far);
-
- if(initialized && null != gl) {
- st.glUniform(gl, mgl_PMVMatrix);
- }
-
- return true;
- }
-
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/graph/curve/opengl/TextRenderer.java b/turtle2d/src/com/jogamp/graph/curve/opengl/TextRenderer.java
deleted file mode 100644
index 2bb99d27c..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.jogamp.graph.curve.opengl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import javax.media.opengl.GL2ES2;
-
-import jogamp.graph.curve.text.GlyphString;
-import jogamp.graph.font.FontInt;
-import jogamp.graph.geom.plane.AffineTransform;
-import jogamp.graph.geom.plane.Path2D;
-
-import com.jogamp.graph.font.Font;
-import com.jogamp.graph.geom.Vertex;
-
-public abstract class TextRenderer extends Renderer {
-
- /**
- * Create a Hardware accelerated Text Renderer.
- * @param factory optional Point.Factory for Vertex construction. Default is Vertex.Factory.
- */
- public static TextRenderer create(Vertex.Factory<? extends Vertex> factory, int type) {
- return new jogamp.graph.curve.opengl.TextRendererImpl01(factory, type);
- }
-
- protected TextRenderer(Vertex.Factory<? extends Vertex> factory, int type) {
- super(factory, type);
- }
-
- /** Render the String in 3D space wrt to the font provided at the position provided
- * the outlines will be generated, if not yet generated
- * @param gl the current GL state
- * @param font {@link Font} to be used
- * @param str text to be rendered
- * @param position the lower left corner of the string
- * @param fontSize font size
- * @param texSize texture size for multipass render
- * @throws Exception if TextRenderer not initialized
- */
- public abstract void renderString3D(GL2ES2 gl, Font font,
- String str, float[] position, int fontSize, int texSize);
-
- /**Create the resulting {@link GlyphString} that represents
- * the String wrt to the font.
- * @param font {@link Font} to be used
- * @param size font size
- * @param str {@link String} to be created
- * @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) {
- AffineTransform affineTransform = new AffineTransform(pointFactory);
-
- Path2D[] paths = new Path2D[str.length()];
- ((FontInt)font).getOutline(str, size, affineTransform, paths);
-
- GlyphString glyphString = new GlyphString(pointFactory, font.getName(), str);
- glyphString.createfromFontPath(paths, affineTransform);
- glyphString.generateRegion(gl.getContext(), sharpness, st, renderType);
-
- return glyphString;
- }
-
- public void flushCache() {
- Iterator<GlyphString> iterator = stringCacheMap.values().iterator();
- while(iterator.hasNext()){
- GlyphString glyphString = iterator.next();
- glyphString.destroy();
- }
- stringCacheMap.clear();
- stringCacheArray.clear();
- }
-
- public final void setCacheMaxSize(int newSize ) { stringCacheMaxSize = newSize; validateCache(0); }
- public final int getCacheMaxSize() { return stringCacheMaxSize; }
- public final int getCacheSize() { return stringCacheArray.size(); }
-
- protected void validateCache(int space) {
- while ( getCacheSize() + space > getCacheMaxSize() ) {
- String key = stringCacheArray.remove(0);
- stringCacheMap.remove(key);
- }
- }
-
- protected GlyphString getCachedGlyphString(Font font, String str, int fontSize) {
- final String key = font.getName() + "." + str.hashCode() + "." + fontSize;
- return stringCacheMap.get(key);
- }
-
- protected void addCachedGlyphString(Font font, String str, int fontSize, GlyphString glyphString) {
- final String key = font.getName() + "." + str.hashCode() + "." + fontSize;
- validateCache(1);
- stringCacheMap.put(key, glyphString);
- stringCacheArray.add(stringCacheArray.size(), key);
- }
-
- // Cache is adding at the end of the array
- public static final int DEFAULT_CACHE_SIZE = 32;
- private HashMap<String, GlyphString> stringCacheMap = new HashMap<String, GlyphString>(DEFAULT_CACHE_SIZE);
- private ArrayList<String> stringCacheArray = new ArrayList<String>(DEFAULT_CACHE_SIZE);
- private int stringCacheMaxSize = DEFAULT_CACHE_SIZE; // -1 unlimited, 0 off, >0 limited
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java b/turtle2d/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java
deleted file mode 100644
index a2e4ca50f..000000000
--- a/turtle2d/src/com/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * 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.graph.curve.tess;
-
-import java.util.ArrayList;
-
-import jogamp.graph.curve.tess.GraphOutline;
-import jogamp.graph.curve.tess.GraphVertex;
-import jogamp.graph.curve.tess.Loop;
-
-import com.jogamp.graph.geom.Outline;
-import com.jogamp.graph.geom.Triangle;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.math.VectorUtil;
-
-import jogamp.opengl.Debug;
-
-/** Constrained Delaunay Triangulation
- * implementation of a list of Outlines that define a set of
- * Closed Regions with optional n holes.
- *
- */
-public class CDTriangulator2D {
-
- protected static final boolean DEBUG = Debug.debug("Triangulation");
-
- private float sharpness = 0.5f;
- private ArrayList<Loop> loops;
- private ArrayList<Vertex> vertices;
-
- private ArrayList<Triangle> triangles;
- private int maxTriID = 0;
-
-
- public CDTriangulator2D() {
- this(0.5f);
- }
-
- /** Constructor for a new Delaunay triangulator
- * @param curveSharpness the curvature around
- * the off-curve vertices
- */
- public CDTriangulator2D(float curveSharpness) {
- this.sharpness = curveSharpness;
- reset();
- }
-
- /** Reset the triangulation to initial state
- * Clearing cached data
- */
- public void reset() {
- maxTriID = 0;
- vertices = new ArrayList<Vertex>();
- triangles = new ArrayList<Triangle>(3);
- loops = new ArrayList<Loop>();
- }
-
- /** Add a curve to the list of profiles provided
- * @param polyline a bounding {@link Outline}
- */
- public void addCurve(Outline polyline){
- Loop loop = null;
-
- if(!loops.isEmpty()){
- loop = getContainerLoop(polyline);
- }
-
- if(loop == null) {
- GraphOutline outline = new GraphOutline(polyline);
- GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
- vertices.addAll(polyline.getVertices());
- loop = new Loop(innerPoly, VectorUtil.CCW);
- loops.add(loop);
- }
- else {
- GraphOutline outline = new GraphOutline(polyline);
- GraphOutline innerPoly = extractBoundaryTriangles(outline, true);
- vertices.addAll(innerPoly.getPoints());
- loop.addConstraintCurve(innerPoly);
- }
- }
-
- /** Generate the triangulation of the provided
- * List of {@link Outline}s
- */
- public ArrayList<Triangle> generateTriangulation(){
- for(int i=0;i<loops.size();i++) {
- Loop loop = loops.get(i);
- int numTries = 0;
- int size = loop.computeLoopSize();
- while(!loop.isSimplex()){
- Triangle tri = null;
- if(numTries > size){
- tri = loop.cut(false);
- }
- else{
- tri = loop.cut(true);
- }
- numTries++;
-
- if(tri != null) {
- numTries = 0;
- size--;
- tri.setId(maxTriID++);
- triangles.add(tri);
- if(DEBUG){
- System.err.println(tri);
- }
- }
- if(numTries > size*2){
- if(DEBUG){
- System.err.println("Triangulation not complete!");
- }
- break;
- }
- }
- Triangle tri = loop.cut(true);
- if(tri != null)
- triangles.add(tri);
- }
- return triangles;
- }
-
- private GraphOutline extractBoundaryTriangles(GraphOutline outline, boolean hole){
- GraphOutline innerOutline = new GraphOutline();
- ArrayList<GraphVertex> outVertices = outline.getGraphPoint();
- int size = outVertices.size();
- for(int i=0; i < size; i++) {
- GraphVertex currentVertex = outVertices.get(i);
- GraphVertex gv0 = outVertices.get((i+size-1)%size);
- GraphVertex gv2 = outVertices.get((i+1)%size);
- GraphVertex gv1 = currentVertex;
-
- if(!currentVertex.getPoint().isOnCurve()) {
- Vertex v0 = gv0.getPoint().clone();
- Vertex v2 = gv2.getPoint().clone();
- Vertex v1 = gv1.getPoint().clone();
-
- gv0.setBoundaryContained(true);
- gv1.setBoundaryContained(true);
- gv2.setBoundaryContained(true);
-
- Triangle t= null;
- boolean holeLike = false;
- if(VectorUtil.ccw(v0,v1,v2)){
- t = new Triangle(v0, v1, v2);
- }
- else {
- holeLike = true;
- t = new Triangle(v2, v1, v0);
- }
- t.setId(maxTriID++);
- triangles.add(t);
- if(DEBUG){
- System.err.println(t);
- }
- if(hole || holeLike) {
- v0.setTexCoord(0, -0.1f);
- v2.setTexCoord(1, -0.1f);
- v1.setTexCoord(0.5f, -1*sharpness -0.1f);
- innerOutline.addVertex(currentVertex);
- }
- else {
- v0.setTexCoord(0, 0.1f);
- v2.setTexCoord(1, 0.1f);
- v1.setTexCoord(0.5f, sharpness+0.1f);
- }
- }
- else {
- if(!gv2.getPoint().isOnCurve() || !gv0.getPoint().isOnCurve()){
- currentVertex.setBoundaryContained(true);
- }
- innerOutline.addVertex(currentVertex);
- }
- }
- return innerOutline;
- }
-
- private Loop getContainerLoop(Outline polyline){
- ArrayList<Vertex> vertices = polyline.getVertices();
- for(Vertex vert: vertices){
- for (Loop loop:loops){
- if(loop.checkInside(vert)){
- return loop;
- }
- }
- }
- return null;
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/font/Font.java b/turtle2d/src/com/jogamp/graph/font/Font.java
deleted file mode 100644
index a4ab527e2..000000000
--- a/turtle2d/src/com/jogamp/graph/font/Font.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * 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.graph.font;
-
-import com.jogamp.graph.geom.AABBox;
-
-/**
- * Interface wrapper for font implementation.
- *
- * TrueType Font Specification:
- * http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html
- *
- * TrueType Font Table Introduction:
- * http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08
- */
-
-public interface Font {
-
- /**
- * Metrics for font
- *
- * Depending on the font's direction, horizontal or vertical,
- * the following tables shall be used:
- *
- * Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
- * Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
- */
- public interface Metrics {
- float getAscent(float pixelSize);
- float getDescent(float pixelSize);
- float getLineGap(float pixelSize);
- float getMaxExtend(float pixelSize);
- float getScale(float pixelSize);
- AABBox getBBox(float pixelSize);
- }
-
- /**
- * Glyph for font
- */
- public interface Glyph {
- public Font getFont();
- public char getSymbol();
- public AABBox getBBox(float pixelSize);
- public float getAdvance(float pixelSize, boolean useFrationalMetrics);
- }
-
-
- public String getName();
-
- public Metrics getMetrics();
- public Glyph getGlyph(char symbol);
- public int getNumGlyphs();
-
- public float getStringWidth(String string, float pixelSize);
- public float getStringHeight(String string, float pixelSize);
- public AABBox getStringBounds(CharSequence string, float pixelSize);
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/graph/font/FontFactory.java b/turtle2d/src/com/jogamp/graph/font/FontFactory.java
deleted file mode 100644
index 1752a693c..000000000
--- a/turtle2d/src/com/jogamp/graph/font/FontFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright 2011 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.graph.font;
-
-import java.security.AccessController;
-
-import com.jogamp.common.util.ReflectionUtil;
-
-import jogamp.graph.font.FontConstructor;
-import jogamp.graph.font.JavaFontLoader;
-import jogamp.graph.font.UbuntuFontLoader;
-import jogamp.opengl.Debug;
-
-public class FontFactory {
- /** Ubuntu is the default font family */
- public static final int UBUNTU = 0;
-
- /** Java fonts are optional */
- public static final int JAVA = 1;
-
- private static final FontConstructor fontConstr;
-
- static {
- /**
- * For example:
- * "jogamp.graph.font.typecast.TypecastFontFactory" (default)
- * "jogamp.graph.font.ttf.TTFFontImpl"
- */
- String fontImplName = Debug.getProperty("FontImpl", true, AccessController.getContext());
- if(null == fontImplName) {
- fontImplName = "jogamp.graph.font.typecast.TypecastFontConstructor";
- }
- fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader());
- }
-
- public static final FontConstructor getFontConstr() { return fontConstr; }
-
- public static final FontSet getDefault() {
- return get(UBUNTU);
- }
-
- public static final FontSet get(int font) {
- switch (font) {
- case JAVA:
- return JavaFontLoader.get();
- default:
- return UbuntuFontLoader.get();
- }
- }
-
- public static final Font get(String path) {
- return fontConstr.create(path);
- }
-
-}
diff --git a/turtle2d/src/com/jogamp/graph/font/FontSet.java b/turtle2d/src/com/jogamp/graph/font/FontSet.java
deleted file mode 100644
index 0cee81124..000000000
--- a/turtle2d/src/com/jogamp/graph/font/FontSet.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright 2011 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.graph.font;
-
-
-public interface FontSet {
-
- /** Font family REGULAR **/
- public static final int FAMILY_REGULAR = 0;
-
- /** Font family LIGHT **/
- public static final int FAMILY_LIGHT = 1;
-
- /** Font family MEDIUM **/
- public static final int FAMILY_MEDIUM = 2;
-
- /** Font family CONDENSED **/
- public static final int FAMILY_CONDENSED = 3;
-
- /** Font family MONO **/
- public static final int FAMILY_MONOSPACED = 4;
-
- /** SERIF style/family bit flag. Fallback to Sans Serif. */
- public static final int STYLE_SERIF = 1 << 1;
-
- /** BOLD style bit flag */
- public static final int STYLE_BOLD = 1 << 2;
-
- /** ITALIC style bit flag */
- public static final int STYLE_ITALIC = 1 << 3;
-
- Font getDefault();
-
- Font get(int family, int stylebits);
-}
diff --git a/turtle2d/src/com/jogamp/graph/geom/AABBox.java b/turtle2d/src/com/jogamp/graph/geom/AABBox.java
deleted file mode 100644
index 8cd06329e..000000000
--- a/turtle2d/src/com/jogamp/graph/geom/AABBox.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/**
- * 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.graph.geom;
-
-import com.jogamp.graph.math.VectorUtil;
-
-/**
- * Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high)
- * The low being the the lower left corner of the box, and the high being the upper
- * right corner of the box.
- *
- */
-public class AABBox {
- private float[] low = {Float.MAX_VALUE,Float.MAX_VALUE,Float.MAX_VALUE};
- private float[] high = {-1*Float.MAX_VALUE,-1*Float.MAX_VALUE,-1*Float.MAX_VALUE};
- private float[] center = new float[3];
-
- /** Create a Axis Aligned bounding box (AABBox)
- * where the low and and high MAX float Values.
- */
- public AABBox() {}
-
- /** Create an AABBox specifying the coordinates
- * of the low and high
- * @param lx min x-coordinate
- * @param ly min y-coordnate
- * @param lz min z-coordinate
- * @param hx max x-coordinate
- * @param hy max y-coordinate
- * @param hz max z-coordinate
- */
- public AABBox(float lx, float ly, float lz,
- float hx, float hy, float hz)
- {
- setLow(lx, ly, lz);
- setHigh(hx, hy, hz);
-
- computeCenter();
- }
-
- /** Create a AABBox defining the low and high
- * @param low min xyz-coordinates
- * @param high max xyz-coordinates
- */
- public AABBox(float[] low, float[] high)
- {
- this.low = low;
- this.high = high;
-
- computeCenter();
- }
-
- /** Get the max xyz-coordinates
- * @return a float array containing the max xyz coordinates
- */
- public float[] getHigh()
- {
- return high;
- }
-
- private void setHigh(float hx, float hy, float hz)
- {
- this.high[0] = hx;
- this.high[1] = hy;
- this.high[2] = hz;
- }
-
- /** Get the min xyz-coordinates
- * @return a float array containing the min xyz coordinates
- */
- public float[] getLow()
- {
- return low;
- }
-
- private void setLow(float lx, float ly, float lz)
- {
- this.low[0] = lx;
- this.low[1] = ly;
- this.low[2] = lz;
- }
-
- /** Resize the AABBox to encapsulate another AABox
- * @param newBox AABBox to be encapsulated in
- */
- public void resize(AABBox newBox)
- {
- float[] newLow = newBox.getLow();
- float[] newHigh = newBox.getHigh();
-
- /** test low */
- if (newLow[0] < low[0])
- low[0] = newLow[0];
- if (newLow[1] < low[1])
- low[1] = newLow[1];
- if (newLow[2] < low[2])
- low[2] = newLow[2];
-
- /** test high */
- if (newHigh[0] > high[0])
- high[0] = newHigh[0];
- if (newHigh[1] > high[1])
- high[1] = newHigh[1];
- if (newHigh[2] > high[2])
- high[2] = newHigh[2];
-
- computeCenter();
- }
-
- private void computeCenter()
- {
- center[0] = (high[0] + low[0])/2;
- center[1] = (high[1] + low[1])/2;
- center[2] = (high[2] + low[2])/2;
- }
-
- /** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- */
- public void resize(float x, float y, float z)
- {
- /** test low */
- if (x < low[0])
- low[0] = x;
- if (y < low[1])
- low[1] = y;
- if (z < low[2])
- low[2] = z;
-
- /** test high */
- if (x > high[0])
- high[0] = x;
- if (y > high[1])
- high[1] = y;
- if (z > high[2])
- high[2] = z;
-
- computeCenter();
- }
-
- /** Check if the x & y coordinates are bounded/contained
- * by this AABBox
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y)
- */
- public boolean contains(float x, float y){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- return true;
- }
-
- /** Check if the xyz coordinates are bounded/contained
- * by this AABBox.
- * @param x x-axis coordinate value
- * @param y y-axis coordinate value
- * @param z z-axis coordinate value
- * @return true if x belong to (low.x, high.x) and
- * y belong to (low.y, high.y) and z belong to (low.z, high.z)
- */
- public boolean contains(float x, float y, float z){
- if(x<low[0] || x>high[0]){
- return false;
- }
- if(y<low[1]|| y>high[1]){
- return false;
- }
- if(z<low[2] || z>high[2]){
- return false;
- }
- return true;
- }
-
- /** Check if there is a common region between this AABBox and the passed
- * 2D region irrespective of z range
- * @param x lower left x-coord
- * @param y lower left y-coord
- * @param w width
- * @param h hight
- * @return true if this AABBox might have a common region with this 2D region
- */
- public boolean intersects(float x, float y, float w, float h) {
- if (w <= 0 || h <= 0) {
- return false;
- }
-
- final float _w = getWidth();
- final float _h = getHeight();
- if (_w <= 0 || _h <= 0) {
- return false;
- }
-
- final float x0 = getMinX();
- final float y0 = getMinY();
- return (x + w > x0 &&
- y + h > y0 &&
- x < x0 + _w &&
- y < y0 + _h);
- }
-
-
- /** Get the size of the Box where the size is represented by the
- * length of the vector between low and high.
- * @return a float representing the size of the AABBox
- */
- public float getSize(){
- return VectorUtil.computeLength(low, high);
- }
-
- /**Get the Center of the AABBox
- * @return the xyz-coordinates of the center of the AABBox
- */
- public float[] getCenter() {
- return center;
- }
-
- /** Scale the AABBox by a constant
- * @param size a constant float value
- */
- public void scale(float size) {
- float[] diffH = new float[3];
- diffH[0] = high[0] - center[0];
- diffH[1] = high[1] - center[1];
- diffH[2] = high[2] - center[2];
-
- diffH = VectorUtil.scale(diffH, size);
-
- float[] diffL = new float[3];
- diffL[0] = low[0] - center[0];
- diffL[1] = low[1] - center[1];
- diffL[2] = low[2] - center[2];
-
- diffL = VectorUtil.scale(diffL, size);
-
- high = VectorUtil.vectorAdd(center, diffH);
- low = VectorUtil.vectorAdd(center, diffL);
- }
-
- public float getMinX() {
- return low[0];
- }
-
- public float getMinY() {
- return low[1];
- }
-
- public float getWidth(){
- return high[0] - low[0];
- }
-
- public float getHeight() {
- return high[1] - low[1];
- }
-
- public float getDepth() {
- return high[2] - low[2];
- }
- public AABBox clone(){
- return new AABBox(this.low, this.high);
- }
-
- public String toString() {
- return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
- center[0]+"/"+center[1]+"/"+center[1]+" ]";
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/geom/Outline.java b/turtle2d/src/com/jogamp/graph/geom/Outline.java
deleted file mode 100644
index a805adf6c..000000000
--- a/turtle2d/src/com/jogamp/graph/geom/Outline.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * 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.graph.geom;
-
-import java.util.ArrayList;
-
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.math.VectorUtil;
-
-
-
-/** Define a single continuous stroke by control vertices.
- * The vertices define the shape of the region defined by this
- * outline. The Outline can contain a list of off-curve and on-curve
- * vertices which define curved regions.
- *
- * Note: An outline should be closed to be rendered as a region.
- *
- * @see OutlineShape, Region
- */
-public class Outline implements Comparable<Outline> {
-
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>(3);
- private boolean closed = false;
- private AABBox box = new AABBox();
-
- /**Create an outline defined by control vertices.
- * An outline can contain off Curve vertices which define curved
- * regions in the outline.
- */
- public Outline(){
-
- }
-
- /** Add a vertex to the outline. The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param vertex Vertex to be added
- */
- public final void addVertex(Vertex vertex) {
- vertices.add(vertex);
- box.resize(vertex.getX(), vertex.getY(), vertex.getZ());
- }
-
- /** Add a {@link Vertex} by specifying its 2D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, boolean onCurve) {
- addVertex(factory, x, y, 0f, onCurve);
- }
-
- /** Add a {@link Vertex} by specifying its 3D attributes to the outline.
- * The {@link Vertex} is added at the
- * end of the outline loop/strip.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param x the x coordinate
- * @param y the y coordinate
- * @param z the z coordinate
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float x, float y, float z, boolean onCurve) {
- Vertex v = factory.create(x, y, z);
- v.setOnCurve(onCurve);
- addVertex(v);
- }
-
- /** Add a vertex to the outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
- * The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
- * are set implicitly to zero.
- * @param factory a {@link Factory} to get the required Vertex impl
- * @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
- * @param offset the offset in the buffer to the x coordinate
- * @param length the number of attributes to pick from the buffer (maximum 3)
- * @param onCurve flag if this vertex is on the final curve or defines a curved region
- * of the shape around this vertex.
- */
- public final void addVertex(Vertex.Factory<? extends Vertex> factory, float[] coordsBuffer, int offset, int length, boolean onCurve) {
- Vertex v = factory.create(coordsBuffer, offset, length);
- v.setOnCurve(onCurve);
- addVertex(v);
- }
-
- public Vertex getVertex(int index){
- return vertices.get(index);
- }
-
- public boolean isEmpty(){
- return (vertices.size() == 0);
- }
- public Vertex getLastVertex(){
- if(isEmpty()){
- return null;
- }
- return vertices.get(vertices.size()-1);
- }
-
- public ArrayList<Vertex> getVertices() {
- return vertices;
- }
- public void setVertices(ArrayList<Vertex> vertices) {
- this.vertices = vertices;
- }
- public AABBox getBox() {
- return box;
- }
- public boolean isClosed() {
- return closed;
- }
-
- /** define if this outline is closed or not.
- * if set to closed, checks if the last vertex is
- * equal to the first vertex. If not Equal adds a
- * vertex at the end to the list.
- * @param closed
- */
- public void setClosed(boolean closed) {
- this.closed = closed;
- if(closed){
- Vertex first = vertices.get(0);
- Vertex last = getLastVertex();
- if(!VectorUtil.checkEquality(first.getCoord(), last.getCoord())){
- Vertex v = first.clone();
- vertices.add(v);
- }
- }
- }
-
- /** Compare two outlines with Bounding Box area
- * as criteria.
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(Outline outline) {
- float size = box.getSize();
- float newSize = outline.getBox().getSize();
- if(size < newSize){
- return -1;
- }
- else if(size > newSize){
- return 1;
- }
- return 0;
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/geom/Triangle.java b/turtle2d/src/com/jogamp/graph/geom/Triangle.java
deleted file mode 100644
index d13e8ddb1..000000000
--- a/turtle2d/src/com/jogamp/graph/geom/Triangle.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.graph.geom;
-
-public class Triangle {
- private int id = Integer.MAX_VALUE;
- final private Vertex[] vertices;
- private boolean[] boundaryEdges = new boolean[3];
- private boolean[] boundaryVertices = null;
-
- public Triangle(Vertex ... v123){
- vertices = v123;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public Vertex[] getVertices() {
- return vertices;
- }
-
- public boolean isEdgesBoundary() {
- return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
- }
-
- public boolean isVerticesBoundary() {
- return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
- }
-
- public void setEdgesBoundary(boolean[] boundary) {
- this.boundaryEdges = boundary;
- }
-
- public boolean[] getEdgeBoundary() {
- return boundaryEdges;
- }
-
- public boolean[] getVerticesBoundary() {
- return boundaryVertices;
- }
-
- public void setVerticesBoundary(boolean[] boundaryVertices) {
- this.boundaryVertices = boundaryVertices;
- }
-
- public String toString() {
- return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/geom/Vertex.java b/turtle2d/src/com/jogamp/graph/geom/Vertex.java
deleted file mode 100644
index 0e4e5e8df..000000000
--- a/turtle2d/src/com/jogamp/graph/geom/Vertex.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Copyright 2011 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.graph.geom;
-
-/**
- * A Vertex with custom memory layout using custom factory.
- */
-public interface Vertex extends Comparable<Vertex>, Cloneable {
-
- public static interface Factory <T extends Vertex> {
- T create();
-
- T create(float x, float y);
-
- T create(float x, float y, float z);
-
- T create(float[] coordsBuffer, int offset, int length);
- }
-
- void setCoord(float x, float y);
-
- void setCoord(float x, float y, float z);
-
- void setCoord(float[] coordsBuffer, int offset, int length);
-
- float[] getCoord();
-
- void setX(float x);
-
- void setY(float y);
-
- void setZ(float z);
-
- float getX();
-
- float getY();
-
- float getZ();
-
- boolean isOnCurve();
-
- void setOnCurve(boolean onCurve);
-
- int getId();
-
- void setId(int id);
-
- int compareTo(Vertex p);
-
- float[] getTexCoord();
-
- void setTexCoord(float s, float t);
-
- Vertex clone();
-}
diff --git a/turtle2d/src/com/jogamp/graph/geom/opengl/SVertex.java b/turtle2d/src/com/jogamp/graph/geom/opengl/SVertex.java
deleted file mode 100644
index 681067e40..000000000
--- a/turtle2d/src/com/jogamp/graph/geom/opengl/SVertex.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * 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.graph.geom.opengl;
-
-
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.graph.math.VectorUtil;
-
-/** A Simple Vertex Implementation. Where the coordinates, and other attributes are
- * float based, and the coordinates and texture coordinates are saved in two float arrays.
- *
- */
-public class SVertex implements Vertex {
- private int id = Integer.MAX_VALUE;
- protected float[] coord = new float[3];
- protected boolean onCurve = true;
- private float[] texCoord = new float[2];
-
- static final Factory factory = new Factory();
-
- public static Factory factory() { return factory; }
-
- public static class Factory implements Vertex.Factory<SVertex> {
- @Override
- public SVertex create() {
- return new SVertex();
- }
-
- @Override
- public SVertex create(float x, float y) {
- return new SVertex(x, y);
- }
-
- @Override
- public SVertex create(float x, float y, float z) {
- return new SVertex(x, y, z);
- }
-
- @Override
- public SVertex create(float[] coordsBuffer, int offset, int length) {
- return new SVertex(coordsBuffer, offset, length);
- }
- }
-
- public SVertex() {
- }
-
- public SVertex(float x, float y) {
- setCoord(x, y);
- }
- public SVertex(float x, float y, float z) {
- setCoord(x, y, z);
- }
- public SVertex(float[] coordsBuffer, int offset, int length) {
- setCoord(coordsBuffer, offset, length);
- }
-
- public void setCoord(float x, float y) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = 0f;
- }
-
- public void setCoord(float x, float y, float z) {
- this.coord[0] = x;
- this.coord[1] = y;
- this.coord[2] = z;
- }
-
- public void setCoord(float[] coordsBuffer, int offset, int length) {
- if(length > coordsBuffer.length - offset) {
- throw new IndexOutOfBoundsException("coordsBuffer too small: "+coordsBuffer.length+" - "+offset+" < "+length);
- }
- if(length > 3) {
- throw new IndexOutOfBoundsException("length too big: "+length+" > "+3);
- }
- int i=0;
- while(i<length) {
- this.coord[i++] = coordsBuffer[offset++];
- }
- }
-
- public float[] getCoord() {
- return coord;
- }
-
- public void setX(float x) {
- this.coord[0] = x;
- }
-
- public void setY(float y) {
- this.coord[1] = y;
- }
-
- public void setZ(float z) {
- this.coord[2] = z;
- }
-
- public float getX() {
- return this.coord[0];
- }
-
- public float getY() {
- return this.coord[1];
- }
-
- public float getZ() {
- return this.coord[2];
- }
-
- public boolean isOnCurve() {
- return onCurve;
- }
-
- public void setOnCurve(boolean onCurve) {
- this.onCurve = onCurve;
- }
-
- public int getId(){
- return id;
- }
-
- public void setId(int id){
- this.id = id;
- }
-
- public int compareTo(Vertex p) {
- if(VectorUtil.checkEquality(coord, p.getCoord())) {
- return 0;
- }
- return -1;
- }
-
- public float[] getTexCoord() {
- return texCoord;
- }
-
- public void setTexCoord(float s, float t) {
- this.texCoord[0] = s;
- this.texCoord[1] = t;
- }
-
- public SVertex clone(){
- SVertex v = new SVertex(this.coord, 0, 3);
- v.setOnCurve(this.onCurve);
- return v;
- }
-
- public String toString() {
- return "[ID: " + id + " X: " + coord[0]
- + " Y: " + coord[1] + " Z: " + coord[2] + "]";
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/math/Quaternion.java b/turtle2d/src/com/jogamp/graph/math/Quaternion.java
deleted file mode 100755
index b77a5fa08..000000000
--- a/turtle2d/src/com/jogamp/graph/math/Quaternion.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/**
- * 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.graph.math;
-
-import jogamp.graph.math.MathFloat;
-
-public class Quaternion {
- protected float x,y,z,w;
-
- public Quaternion(){
-
- }
-
- public Quaternion(float x, float y, float z, float w) {
- this.x = x;
- this.y = y;
- this.z = z;
- this.w = w;
- }
-
- /** Constructor to create a rotation based quaternion from two vectors
- * @param vector1
- * @param vector2
- */
- public Quaternion(float[] vector1, float[] vector2)
- {
- float theta = (float)MathFloat.acos(dot(vector1, vector2));
- float[] cross = cross(vector1,vector2);
- cross = normalizeVec(cross);
-
- this.x = (float)MathFloat.sin(theta/2)*cross[0];
- this.y = (float)MathFloat.sin(theta/2)*cross[1];
- this.z = (float)MathFloat.sin(theta/2)*cross[2];
- this.w = (float)MathFloat.cos(theta/2);
- this.normalize();
- }
-
- /** Transform the rotational quaternion to axis based rotation angles
- * @return new float[4] with ,theta,Rx,Ry,Rz
- */
- public float[] toAxis()
- {
- float[] vec = new float[4];
- float scale = (float)MathFloat.sqrt(x * x + y * y + z * z);
- vec[0] =(float) MathFloat.acos(w) * 2.0f;
- vec[1] = x / scale;
- vec[2] = y / scale;
- vec[3] = z / scale;
- return vec;
- }
-
- /** Normalize a vector
- * @param vector input vector
- * @return normalized vector
- */
- private float[] normalizeVec(float[] vector)
- {
- float[] newVector = new float[3];
-
- float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
- if(d> 0.0f)
- {
- newVector[0] = vector[0]/d;
- newVector[1] = vector[1]/d;
- newVector[2] = vector[2]/d;
- }
- return newVector;
- }
- /** compute the dot product of two points
- * @param vec1 vector 1
- * @param vec2 vector 2
- * @return the dot product as float
- */
- private float dot(float[] vec1, float[] vec2)
- {
- return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
- }
- /** cross product vec1 x vec2
- * @param vec1 vector 1
- * @param vec2 vecttor 2
- * @return the resulting vector
- */
- private float[] cross(float[] vec1, float[] vec2)
- {
- float[] out = new float[3];
-
- out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
- out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
- out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
-
- return out;
- }
- public float getW() {
- return w;
- }
- public void setW(float w) {
- this.w = w;
- }
- public float getX() {
- return x;
- }
- public void setX(float x) {
- this.x = x;
- }
- public float getY() {
- return y;
- }
- public void setY(float y) {
- this.y = y;
- }
- public float getZ() {
- return z;
- }
- public void setZ(float z) {
- this.z = z;
- }
-
- /** Add a quaternion
- * @param q quaternion
- */
- public void add(Quaternion q)
- {
- x+=q.x;
- y+=q.y;
- z+=q.z;
- }
-
- /** Subtract a quaternion
- * @param q quaternion
- */
- public void subtract(Quaternion q)
- {
- x-=q.x;
- y-=q.y;
- z-=q.z;
- }
-
- /** Divide a quaternion by a constant
- * @param n a float to divide by
- */
- public void divide(float n)
- {
- x/=n;
- y/=n;
- z/=n;
- }
-
- /** Multiply this quaternion by
- * the param quaternion
- * @param q a quaternion to multiply with
- */
- public void mult(Quaternion q)
- {
- float w1 = w*q.w - (x*q.x + y*q.y + z*q.z);
-
- float x1 = w*q.z + q.w*z + y*q.z - z*q.y;
- float y1 = w*q.x + q.w*x + z*q.x - x*q.z;
- float z1 = w*q.y + q.w*y + x*q.y - y*q.x;
-
- w = w1;
- x = x1;
- y = y1;
- z = z1;
- }
-
- /** Multiply a quaternion by a constant
- * @param n a float constant
- */
- public void mult(float n)
- {
- x*=n;
- y*=n;
- z*=n;
- }
-
- /** Normalize a quaternion required if
- * to be used as a rotational quaternion
- */
- public void normalize()
- {
- float norme = (float)MathFloat.sqrt(w*w + x*x + y*y + z*z);
- if (norme == 0.0f)
- {
- w = 1.0f;
- x = y = z = 0.0f;
- }
- else
- {
- float recip = 1.0f/norme;
-
- w *= recip;
- x *= recip;
- y *= recip;
- z *= recip;
- }
- }
-
- /** Invert the quaternion If rotational,
- * will produce a the inverse rotation
- */
- public void inverse()
- {
- float norm = w*w + x*x + y*y + z*z;
-
- float recip = 1.0f/norm;
-
- w *= recip;
- x = -1*x*recip;
- y = -1*y*recip;
- z = -1*z*recip;
- }
-
- /** Transform this quaternion to a
- * 4x4 column matrix representing the rotation
- * @return new float[16] column matrix 4x4
- */
- public float[] toMatrix()
- {
- float[] matrix = new float[16];
- matrix[0] = 1.0f - 2*y*y - 2*z*z;
- matrix[1] = 2*x*y + 2*w*z;
- matrix[2] = 2*x*z - 2*w*y;
- matrix[3] = 0;
-
- matrix[4] = 2*x*y - 2*w*z;
- matrix[5] = 1.0f - 2*x*x - 2*z*z;
- matrix[6] = 2*y*z + 2*w*x;
- matrix[7] = 0;
-
- matrix[8] = 2*x*z + 2*w*y;
- matrix[9] = 2*y*z - 2*w*x;
- matrix[10] = 1.0f - 2*x*x - 2*y*y;
- matrix[11] = 0;
-
- matrix[12] = 0;
- matrix[13] = 0;
- matrix[14] = 0;
- matrix[15] = 1;
- return matrix;
- }
-
- /** Set this quaternion from a Sphereical interpolation
- * of two param quaternion, used mostly for rotational animation
- * @param a initial quaternion
- * @param b target quaternion
- * @param t float between 0 and 1 representing interp.
- */
- public void slerp(Quaternion a,Quaternion b, float t)
- {
- float omega, cosom, sinom, sclp, sclq;
- cosom = a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w;
- if ((1.0f+cosom) > MathFloat.E) {
- if ((1.0f-cosom) > MathFloat.E) {
- omega = (float)MathFloat.acos(cosom);
- sinom = (float)MathFloat.sin(omega);
- sclp = (float)MathFloat.sin((1.0f-t)*omega) / sinom;
- sclq = (float)MathFloat.sin(t*omega) / sinom;
- }
- else {
- sclp = 1.0f - t;
- sclq = t;
- }
- x = sclp*a.x + sclq*b.x;
- y = sclp*a.y + sclq*b.y;
- z = sclp*a.z + sclq*b.z;
- w = sclp*a.w + sclq*b.w;
- }
- else {
- x =-a.y;
- y = a.x;
- z =-a.w;
- w = a.z;
- sclp = MathFloat.sin((1.0f-t) * MathFloat.PI * 0.5f);
- sclq = MathFloat.sin(t * MathFloat.PI * 0.5f);
- x = sclp*a.x + sclq*b.x;
- y = sclp*a.y + sclq*b.y;
- z = sclp*a.z + sclq*b.z;
- }
- }
-
- /** Check if this quaternion is empty, ie (0,0,0,1)
- * @return true if empty, false otherwise
- */
- public boolean isEmpty()
- {
- if (w==1 && x==0 && y==0 && z==0)
- return true;
- return false;
- }
-
- /** Check if this quaternion represents an identity
- * matrix, for rotation.
- * @return true if it is an identity rep., false otherwise
- */
- public boolean isIdentity()
- {
- if (w==0 && x==0 && y==0 && z==0)
- return true;
- return false;
- }
-
- /** compute the quaternion from a 3x3 column matrix
- * @param m 3x3 column matrix
- */
- public void setFromMatrix(float[] m) {
- float T= m[0] + m[4] + m[8] + 1;
- if (T>0){
- float S = 0.5f / (float)MathFloat.sqrt(T);
- w = 0.25f / S;
- x = ( m[5] - m[7]) * S;
- y = ( m[6] - m[2]) * S;
- z = ( m[1] - m[3] ) * S;
- }
- else{
- if ((m[0] > m[4])&(m[0] > m[8])) {
- float S = MathFloat.sqrt( 1.0f + m[0] - m[4] - m[8] ) * 2f; // S=4*qx
- w = (m[7] - m[5]) / S;
- x = 0.25f * S;
- y = (m[3] + m[1]) / S;
- z = (m[6] + m[2]) / S;
- }
- else if (m[4] > m[8]) {
- float S = MathFloat.sqrt( 1.0f + m[4] - m[0] - m[8] ) * 2f; // S=4*qy
- w = (m[6] - m[2]) / S;
- x = (m[3] + m[1]) / S;
- y = 0.25f * S;
- z = (m[7] + m[5]) / S;
- }
- else {
- float S = MathFloat.sqrt( 1.0f + m[8] - m[0] - m[4] ) * 2f; // S=4*qz
- w = (m[3] - m[1]) / S;
- x = (m[6] + m[2]) / S;
- y = (m[7] + m[5]) / S;
- z = 0.25f * S;
- }
- }
- }
-
- /** Check if the the 3x3 matrix (param) is in fact
- * an affine rotational matrix
- * @param m 3x3 column matrix
- * @return true if representing a rotational matrix, false otherwise
- */
- public boolean isRotationMatrix(float[] m) {
- double epsilon = 0.01; // margin to allow for rounding errors
- if (MathFloat.abs(m[0]*m[3] + m[3]*m[4] + m[6]*m[7]) > epsilon) return false;
- if (MathFloat.abs(m[0]*m[2] + m[3]*m[5] + m[6]*m[8]) > epsilon) return false;
- if (MathFloat.abs(m[1]*m[2] + m[4]*m[5] + m[7]*m[8]) > epsilon) return false;
- if (MathFloat.abs(m[0]*m[0] + m[3]*m[3] + m[6]*m[6] - 1) > epsilon) return false;
- if (MathFloat.abs(m[1]*m[1] + m[4]*m[4] + m[7]*m[7] - 1) > epsilon) return false;
- if (MathFloat.abs(m[2]*m[2] + m[5]*m[5] + m[8]*m[8] - 1) > epsilon) return false;
- return (MathFloat.abs(determinant(m)-1) < epsilon);
- }
- private float determinant(float[] m) {
- return m[0]*m[4]*m[8] + m[3]*m[7]*m[2] + m[6]*m[1]*m[5] - m[0]*m[7]*m[5] - m[3]*m[1]*m[8] - m[6]*m[4]*m[2];
- }
-}
diff --git a/turtle2d/src/com/jogamp/graph/math/VectorUtil.java b/turtle2d/src/com/jogamp/graph/math/VectorUtil.java
deleted file mode 100755
index cca9a454f..000000000
--- a/turtle2d/src/com/jogamp/graph/math/VectorUtil.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/**
- * 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.graph.math;
-
-import java.util.ArrayList;
-
-import jogamp.graph.math.MathFloat;
-
-import com.jogamp.graph.geom.Vertex;
-
-public class VectorUtil {
-
- public static final int CW = -1;
- public static final int CCW = 1;
- public static final int COLLINEAR = 0;
-
- /** compute the dot product of two points
- * @param vec1 vector 1
- * @param vec2 vector 2
- * @return the dot product as float
- */
- public static float dot(float[] vec1, float[] vec2)
- {
- return (vec1[0]*vec2[0] + vec1[1]*vec2[1] + vec1[2]*vec2[2]);
- }
- /** Normalize a vector
- * @param vector input vector
- * @return normalized vector
- */
- public static float[] normalize(float[] vector)
- {
- float[] newVector = new float[3];
-
- float d = MathFloat.sqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]);
- if(d> 0.0f)
- {
- newVector[0] = vector[0]/d;
- newVector[1] = vector[1]/d;
- newVector[2] = vector[2]/d;
- }
- return newVector;
- }
-
- /** Scales a vector by param
- * @param vector input vector
- * @param scale constant to scale by
- * @return scaled vector
- */
- public static float[] scale(float[] vector, float scale)
- {
- float[] newVector = new float[3];
-
- newVector[0] = vector[0]*scale;
- newVector[1] = vector[1]*scale;
- newVector[2] = vector[2]*scale;
- return newVector;
- }
-
- /** Adds to vectors
- * @param v1 vector 1
- * @param v2 vector 2
- * @return v1 + v2
- */
- public static float[] vectorAdd(float[] v1, float[] v2)
- {
- float[] newVector = new float[3];
-
- newVector[0] = v1[0] + v2[0];
- newVector[1] = v1[1] + v2[1];
- newVector[2] = v1[2] + v2[2];
- return newVector;
- }
-
- /** cross product vec1 x vec2
- * @param vec1 vector 1
- * @param vec2 vecttor 2
- * @return the resulting vector
- */
- public static float[] cross(float[] vec1, float[] vec2)
- {
- float[] out = new float[3];
-
- out[0] = vec2[2]*vec1[1] - vec2[1]*vec1[2];
- out[1] = vec2[0]*vec1[2] - vec2[2]*vec1[0];
- out[2] = vec2[1]*vec1[0] - vec2[0]*vec1[1];
-
- return out;
- }
-
- /** Column Matrix Vector multiplication
- * @param colMatrix column matrix (4x4)
- * @param vec vector(x,y,z)
- * @return result new float[3]
- */
- public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
- {
- float[] out = new float[3];
-
- out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
- out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
- out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
-
- return out;
- }
-
- /** Matrix Vector multiplication
- * @param rawMatrix column matrix (4x4)
- * @param vec vector(x,y,z)
- * @return result new float[3]
- */
- public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
- {
- float[] out = new float[3];
-
- out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
- out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
- out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
-
- return out;
- }
-
- /** Calculate the midpoint of two values
- * @param p1 first value
- * @param p2 second vale
- * @return midpoint
- */
- public static float mid(float p1, float p2)
- {
- return (p1+p2)/2.0f;
- }
- /** Calculate the midpoint of two points
- * @param p1 first point
- * @param p2 second point
- * @return midpoint
- */
- public static float[] mid(float[] p1, float[] p2)
- {
- float[] midPoint = new float[3];
- midPoint[0] = (p1[0] + p2[0])/2.0f;
- midPoint[1] = (p1[1] + p2[1])/2.0f;
- midPoint[2] = (p1[2] + p2[2])/2.0f;
-
- return midPoint;
- }
- /** Compute the norm of a vector
- * @param vec vector
- * @return vorm
- */
- public static float norm(float[] vec)
- {
- return MathFloat.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
- }
- /** Compute distance between 2 points
- * @param p0 a ref point on the line
- * @param vec vector representing the direction of the line
- * @param point the point to compute the relative distance of
- * @return distance float
- */
- public static float computeLength(float[] p0, float[] point)
- {
- float[] w = new float[]{point[0]-p0[0],point[1]-p0[1],point[2]-p0[2]};
-
- float distance = MathFloat.sqrt(w[0]*w[0] + w[1]*w[1] + w[2]*w[2]);
-
- return distance;
- }
-
- /**Check equality of 2 vec3 vectors
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @return
- */
- public static boolean checkEquality(float[] v1, float[] v2)
- {
- if(Float.compare(v1[0], v2[0]) == 0
- && Float.compare(v1[1] , v2[1]) == 0
- && Float.compare(v1[2], v2[2]) == 0 )
- return true;
- return false;
- }
-
- /** Compute the determinant of 3 vectors
- * @param a vector 1
- * @param b vector 2
- * @param c vector 3
- * @return the determinant value
- */
- public static float computeDeterminant(float[] a, float[] b, float[] c)
- {
- float area = a[0]*b[1]*c[2] + a[1]*b[2]*c[0] + a[2]*b[0]*c[1] - a[0]*b[2]*c[1] - a[1]*b[0]*c[2] - a[2]*b[1]*c[0];
- return area;
- }
-
- /** Check if three vertices are colliniear
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @param v3 vertex 3
- * @return true if collinear, false otherwise
- */
- public static boolean checkCollinear(float[] v1, float[] v2, float[] v3)
- {
- return (computeDeterminant(v1, v2, v3) == VectorUtil.COLLINEAR);
- }
-
- /** Compute Vector
- * @param v1 vertex 1
- * @param v2 vertex2 2
- * @return Vector V1V2
- */
- public static float[] computeVector(float[] v1, float[] v2)
- {
- float[] vector = new float[3];
- vector[0] = v2[0] - v1[0];
- vector[1] = v2[1] - v1[1];
- vector[2] = v2[2] - v1[2];
- return vector;
- }
-
- /** Check if vertices in triangle circumcircle
- * @param a triangle vertex 1
- * @param b triangle vertex 2
- * @param c triangle vertex 3
- * @param d vertex in question
- * @return true if the vertex d is inside the circle defined by the
- * vertices a, b, c. from paper by Guibas and Stolfi (1985).
- */
- public static boolean inCircle(Vertex a, Vertex b, Vertex c, Vertex d){
- return (a.getX() * a.getX() + a.getY() * a.getY()) * triArea(b, c, d) -
- (b.getX() * b.getX() + b.getY() * b.getY()) * triArea(a, c, d) +
- (c.getX() * c.getX() + c.getY() * c.getY()) * triArea(a, b, d) -
- (d.getX() * d.getX() + d.getY() * d.getY()) * triArea(a, b, c) > 0;
- }
-
- /** Computes oriented area of a triangle
- * @param a first vertex
- * @param b second vertex
- * @param c third vertex
- * @return compute twice the area of the oriented triangle (a,b,c), the area
- * is positive if the triangle is oriented counterclockwise.
- */
- public static float triArea(Vertex a, Vertex b, Vertex c){
- return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
- }
-
- /** Check if points are in ccw order
- * @param a first vertex
- * @param b second vertex
- * @param c third vertex
- * @return true if the points a,b,c are in a ccw order
- */
- public static boolean ccw(Vertex a, Vertex b, Vertex c){
- return triArea(a,b,c) > 0;
- }
-
- /** Computes the area of a list of vertices to check if ccw
- * @param vertices
- * @return positve area if ccw else negative area value
- */
- public static float area(ArrayList<Vertex> vertices) {
- int n = vertices.size();
- float area = 0.0f;
- for (int p = n - 1, q = 0; q < n; p = q++)
- {
- float[] pCoord = vertices.get(p).getCoord();
- float[] qCoord = vertices.get(q).getCoord();
- area += pCoord[0] * qCoord[1] - qCoord[0] * pCoord[1];
- }
- return area;
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java
deleted file mode 100644
index 9ad4eb41a..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.jogamp.opengl.test.junit.graph;
-
-import java.io.IOException;
-
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.jogamp.graph.curve.Region;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener01;
-import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener02;
-import com.jogamp.opengl.test.junit.graph.demos.GPURegionRendererListenerBase01;
-
-
-public class TestRegionRenderer01 {
-
- public static void main(String args[]) throws IOException {
- String tstname = TestRegionRenderer01.class.getName();
- org.junit.runner.JUnitCore.main(tstname);
- }
-
- @BeforeClass
- public static void initClass() {
- GLProfile.initSingleton(true);
- NativeWindowFactory.initSingleton(true);
- }
-
- static void destroyWindow(GLWindow window) {
- if(null!=window) {
- window.destroy();
- }
- }
-
- static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
- Assert.assertNotNull(caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setSize(width, height);
- window.setPosition(10, 10);
- window.setTitle(title);
- Assert.assertNotNull(window);
- window.setVisible(true);
-
- return window;
- }
-
- @Test
- public void testRegionRendererR2T01() throws InterruptedException {
- GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- //caps.setOnscreen(false);
- caps.setAlphaBits(4);
-
- GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400);
-
- GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, false, false);
- demo02Listener.attachInputListenerTo(window);
- window.addGLEventListener(demo02Listener);
-
- RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02");
- window.addGLEventListener(listener);
-
- listener.setTech(-20, 00, 0f, -300, 400);
- window.display();
-
- listener.setTech(-20, 00, 0f, -150, 800);
- window.display();
-
- listener.setTech(-20, 00, 0f, -50, 1000);
- window.display();
-
- destroyWindow(window);
- }
-
- @Test
- public void testRegionRendererMSAA01() throws InterruptedException {
- GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
- GLCapabilities caps = new GLCapabilities(glp);
- // caps.setOnscreen(false);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4);
-
- GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400);
-
- GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, false, false);
- demo01Listener.attachInputListenerTo(window);
- window.addGLEventListener(demo01Listener);
-
- RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01");
- window.addGLEventListener(listener);
-
- listener.setTech(-20, 00, 0f, -300, 400);
- window.display();
-
- listener.setTech(-20, 00, 0f, -150, 800);
- window.display();
-
- listener.setTech(-20, 00, 0f, -50, 1000);
- window.display();
-
- destroyWindow(window);
- }
-
- private class RegionGLListener implements GLEventListener {
- String winTitle;
- String name;
- GPURegionRendererListenerBase01 impl;
-
- public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) {
- this.impl = impl;
- this.winTitle = title;
- this.name = name;
- }
-
- public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
- impl.setMatrix(xt, yt, angle, zoom, fboSize);
- }
-
- public void init(GLAutoDrawable drawable) {
- impl.init(drawable);
- }
-
- public void display(GLAutoDrawable drawable) {
- impl.display(drawable);
-
- try {
- impl.printScreen(drawable, "./", winTitle, name, false);
- } catch (GLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public void dispose(GLAutoDrawable drawable) {
- impl.dispose(drawable);
-
- }
-
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- impl.reshape(drawable, x, y, width, height);
-
- }
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java
deleted file mode 100755
index c954c6aa7..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package com.jogamp.opengl.test.junit.graph;
-
-import java.io.IOException;
-
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.jogamp.graph.curve.Region;
-import com.jogamp.graph.curve.opengl.TextRenderer;
-import com.jogamp.graph.font.FontFactory;
-import com.jogamp.graph.geom.opengl.SVertex;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.graph.demos.GPUTextRendererListenerBase01;
-
-
-public class TestTextRenderer01 {
-
- public static void main(String args[]) throws IOException {
- String tstname = TestTextRenderer01.class.getName();
- org.junit.runner.JUnitCore.main(tstname);
- }
-
- @BeforeClass
- public static void initClass() {
- GLProfile.initSingleton(true);
- NativeWindowFactory.initSingleton(true);
- }
-
- static void destroyWindow(GLWindow window) {
- if(null!=window) {
- window.destroy();
- }
- }
-
- static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) {
- Assert.assertNotNull(caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setSize(width, height);
- window.setPosition(10, 10);
- window.setTitle(title);
- Assert.assertNotNull(window);
- window.setVisible(true);
-
- return window;
- }
-
- @Test
- public void testTextRendererR2T01() throws InterruptedException {
- GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
-
- GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400);
- TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS);
- textGLListener.attachInputListenerTo(window);
- window.addGLEventListener(textGLListener);
-
- textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0);
- textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2);
- window.display();
-
- textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3);
- window.display();
-
- textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4);
- window.display();
-
- textGLListener.setFontSet(FontFactory.JAVA, 0, 0);
- textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2);
- window.display();
-
- textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3);
- window.display();
-
- textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4);
- window.display();
-
- destroyWindow(window);
- }
-
- @Test
- public void testTextRendererMSAA01() throws InterruptedException {
- GLProfile glp = GLProfile.get(GLProfile.GL2ES2);
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4);
-
- GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400);
- TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS);
- textGLListener.attachInputListenerTo(window);
- window.addGLEventListener(textGLListener);
-
- textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0);
- textGLListener.setTech(-400, -30, 0f, -1000, 0);
- window.display();
-
- textGLListener.setTech(-400, -30, 0, -380, 0);
- window.display();
-
- textGLListener.setTech(-400, -20, 0, -80, 0);
- window.display();
-
- textGLListener.setFontSet(FontFactory.JAVA, 0, 0);
- textGLListener.setTech(-400, -30, 0f, -1000, 0);
- window.display();
-
- textGLListener.setTech(-400, -30, 0, -380, 0);
- window.display();
-
- textGLListener.setTech(-400, -20, 0, -80, 0);
- window.display();
-
- destroyWindow(window);
- }
-
- private class TextGLListener extends GPUTextRendererListenerBase01 {
- String winTitle;
-
- public TextGLListener(int type) {
- super(SVertex.factory(), type, false, false);
- }
-
- public void attachInputListenerTo(GLWindow window) {
- super.attachInputListenerTo(window);
- winTitle = window.getTitle();
- }
- public void setTech(float xt, float yt, float angle, int zoom, int fboSize){
- setMatrix(xt, yt, angle, zoom, fboSize);
- }
-
- public void init(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- super.init(drawable);
- gl.setSwapInterval(1);
- gl.glEnable(GL.GL_DEPTH_TEST);
-
- final TextRenderer textRenderer = (TextRenderer) getRenderer();
-
- textRenderer.init(gl);
- textRenderer.setAlpha(gl, 1.0f);
- textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- }
-
- public void display(GLAutoDrawable drawable) {
- super.display(drawable);
-
- try {
- printScreen(drawable, "./", winTitle, false);
- } catch (GLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
deleted file mode 100644
index bf4bfab71..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * 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.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAutoDrawable;
-import com.jogamp.graph.curve.OutlineShape;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.geom.opengl.SVertex;
-
-/** Demonstrate the rendering of multiple outlines into one region/OutlineShape
- * These Outlines are not necessary connected or contained.
- * The output of this demo shows two identical shapes but the left one
- * has some vertices with off-curve flag set to true, and the right allt he vertices
- * are on the curve. Demos the Res. Independent Nurbs based Curve rendering
- *
- */
-public class GPURegionGLListener01 extends GPURegionRendererListenerBase01 {
- OutlineShape outlineShape = null;
-
- public GPURegionGLListener01 (int numpass, int fbosize, boolean debug, boolean trace) {
- super(SVertex.factory(), numpass, debug, trace);
- setMatrix(-20, 00, 0f, -50, fbosize);
- }
-
- private void createTestOutline(){
- float offset = 0;
- outlineShape = new OutlineShape(getRenderer().getFactory());
- outlineShape.addVertex(0.0f,-10.0f, true);
- outlineShape.addVertex(15.0f,-10.0f, true);
- outlineShape.addVertex(10.0f,5.0f, false);
- outlineShape.addVertex(15.0f,10.0f, true);
- outlineShape.addVertex(6.0f,15.0f, false);
- outlineShape.addVertex(5.0f,8.0f, false);
- outlineShape.addVertex(0.0f,10.0f,true);
- outlineShape.closeLastOutline();
- outlineShape.addEmptyOutline();
- outlineShape.addVertex(5.0f,-5.0f,true);
- outlineShape.addVertex(10.0f,-5.0f, false);
- outlineShape.addVertex(10.0f,0.0f, true);
- outlineShape.addVertex(5.0f,0.0f, false);
- outlineShape.closeLastOutline();
-
- /** Same shape as above but without any off-curve vertices */
- outlineShape.addEmptyOutline();
- offset = 30;
- outlineShape.addVertex(offset+0.0f,-10.0f, true);
- outlineShape.addVertex(offset+17.0f,-10.0f, true);
- outlineShape.addVertex(offset+11.0f,5.0f, true);
- outlineShape.addVertex(offset+16.0f,10.0f, true);
- outlineShape.addVertex(offset+7.0f,15.0f, true);
- outlineShape.addVertex(offset+6.0f,8.0f, true);
- outlineShape.addVertex(offset+0.0f,10.0f, true);
- outlineShape.closeLastOutline();
- outlineShape.addEmptyOutline();
- outlineShape.addVertex(offset+5.0f,0.0f, true);
- outlineShape.addVertex(offset+5.0f,-5.0f, true);
- outlineShape.addVertex(offset+10.0f,-5.0f, true);
- outlineShape.addVertex(offset+10.0f,0.0f, true);
- outlineShape.closeLastOutline();
- }
-
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
-
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- regionRenderer.init(gl);
- regionRenderer.setAlpha(gl, 1.0f);
- regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- //gl.glSampleCoverage(0.95f, false);
- //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines
- //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE);
- MSAATool.dump(drawable);
-
- createTestOutline();
- }
-
- public void display(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
- final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
-
- regionRenderer.resetModelview(null);
- regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
- regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
-
- regionRenderer.renderOutlineShape(gl, outlineShape, getPosition(), getTexSize());
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
deleted file mode 100644
index 56db37ebe..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAutoDrawable;
-
-import com.jogamp.graph.curve.OutlineShape;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.geom.opengl.SVertex;
-
-/** Demonstrate the rendering of multiple OutlineShapes
- * into one region
- *
- */
-public class GPURegionGLListener02 extends GPURegionRendererListenerBase01 {
- OutlineShape[] outlineShapes = new OutlineShape[2];
-
- public GPURegionGLListener02 (int numpass, int fbosize, boolean debug, boolean trace) {
- super(SVertex.factory(), numpass, debug, trace);
- setMatrix(-20, 00, 0f, -50, fbosize);
- }
-
- private void createTestOutline(){
- float offset = 0;
- outlineShapes[0] = new OutlineShape(SVertex.factory());
- outlineShapes[0].addVertex(0.0f,-10.0f,true);
- outlineShapes[0].addVertex(15.0f,-10.0f, true);
- outlineShapes[0].addVertex(10.0f,5.0f, false);
- outlineShapes[0].addVertex(15.0f,10.0f, true);
- outlineShapes[0].addVertex(6.0f,15.0f, false);
- outlineShapes[0].addVertex(5.0f,8.0f, false);
- outlineShapes[0].addVertex(0.0f,10.0f,true);
- outlineShapes[0].closeLastOutline();
- outlineShapes[0].addEmptyOutline();
- outlineShapes[0].addVertex(5.0f,-5.0f,true);
- outlineShapes[0].addVertex(10.0f,-5.0f, false);
- outlineShapes[0].addVertex(10.0f,0.0f, true);
- outlineShapes[0].addVertex(5.0f,0.0f, false);
- outlineShapes[0].closeLastOutline();
-
- /** Same shape as above but without any off-curve vertices */
- outlineShapes[1] = new OutlineShape(SVertex.factory());
- offset = 30;
- outlineShapes[1].addVertex(offset+0.0f,-10.0f, true);
- outlineShapes[1].addVertex(offset+17.0f,-10.0f, true);
- outlineShapes[1].addVertex(offset+11.0f,5.0f, true);
- outlineShapes[1].addVertex(offset+16.0f,10.0f, true);
- outlineShapes[1].addVertex(offset+7.0f,15.0f, true);
- outlineShapes[1].addVertex(offset+6.0f,8.0f, true);
- outlineShapes[1].addVertex(offset+0.0f,10.0f, true);
- outlineShapes[1].closeLastOutline();
- outlineShapes[1].addEmptyOutline();
- outlineShapes[1].addVertex(offset+5.0f,0.0f, true);
- outlineShapes[1].addVertex(offset+5.0f,-5.0f, true);
- outlineShapes[1].addVertex(offset+10.0f,-5.0f, true);
- outlineShapes[1].addVertex(offset+10.0f,0.0f, true);
- outlineShapes[1].closeLastOutline();
- }
-
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
-
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- regionRenderer.init(gl);
- regionRenderer.setAlpha(gl, 1.0f);
- regionRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- MSAATool.dump(drawable);
-
- createTestOutline();
- }
-
- public void display(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
- final RegionRenderer regionRenderer = (RegionRenderer) getRenderer();
-
- regionRenderer.resetModelview(null);
- regionRenderer.translate(null, getXTran(), getYTran(), getZoom());
- regionRenderer.rotate(gl, getAngle(), 0, 1, 0);
-
- regionRenderer.renderOutlineShapes(gl, outlineShapes, getPosition(), getTexSize());
-
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
deleted file mode 100755
index dbd5fe158..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo01.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-
-/** Demonstrate the rendering of multiple outlines into one region/OutlineShape
- * These Outlines are not necessary connected or contained.
- * The output of this demo shows two identical shapes but the left one
- * has some vertices with off-curve flag set to true, and the right allt he vertices
- * are on the curve. Demos the Res. Independent Nurbs based Curve rendering
- *
- */
-public class GPURegionNewtDemo01 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile.initSingleton(true);
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4); // 2 samples is not enough ..
- System.out.println("Requested: " + caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Curve Region Newt Demo 01 - r2t0 msaa1");
-
- GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, DEBUG, TRACE);
- regionGLListener.attachInputListenerTo(window);
- window.addGLEventListener(regionGLListener);
-
- window.enablePerfLog(true);
- window.setVisible(true);
-
- //FPSAnimator animator = new FPSAnimator(60);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
deleted file mode 100644
index 7ffab59e3..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo02.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-
-/** Demonstrate the rendering of multiple OutlineShapes
- * into one region
- *
- */
-public class GPURegionNewtDemo02 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GPURegionNewtDemo02 test = new GPURegionNewtDemo02();
- test.testMe();
- }
-
- public void testMe() {
- GLProfile.initSingleton(true);
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- System.out.println("Requested: " + caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Curve Region Newt Demo 02 - r2t1 msaa0");
-
- GPURegionGLListener02 regionGLListener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, DEBUG, TRACE);
- regionGLListener.attachInputListenerTo(window);
- window.addGLEventListener(regionGLListener);
-
- window.enablePerfLog(true);
- window.setVisible(true);
-
- //FPSAnimator animator = new FPSAnimator(60);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java
deleted file mode 100644
index eab5fc8eb..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURegionRendererListenerBase01.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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 com.jogamp.graph.curve.OutlineShape;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.geom.Vertex;
-
-/**
- *
- * Action Keys:
- * - 1/2: zoom in/out
- * - 3/4: font +/-
- * - 6/7: 2nd pass texture size
- * - 0/9: rotate
- * - s: toogle draw 'font set'
- * - f: toggle draw fps
- * - v: toggle v-sync
- * - space: toggle font (ubuntu/java)
- */
-public abstract class GPURegionRendererListenerBase01 extends GPURendererListenerBase01 {
- OutlineShape outlineShape = null;
-
- public GPURegionRendererListenerBase01(Vertex.Factory<? extends Vertex> factory, int mode, boolean debug, boolean trace) {
- super(RegionRenderer.create(factory, mode), debug, trace);
- }
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
deleted file mode 100644
index 622178bf2..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/**
- * 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 java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLPipelineFactory;
-import javax.media.opengl.GLRunnable;
-
-import com.jogamp.graph.curve.opengl.Renderer;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.KeyListener;
-import com.jogamp.newt.opengl.GLWindow;
-
-/**
- *
- * Action Keys:
- * - 1/2: zoom in/out
- * - 6/7: 2nd pass texture size
- * - 0/9: rotate
- * - v: toggle v-sync
- * - s: screenshot
- */
-public abstract class GPURendererListenerBase01 implements GLEventListener {
- private Screenshot screenshot;
- private Renderer renderer;
- private boolean debug;
- private boolean trace;
-
- private KeyAction keyAction;
-
- private volatile GLAutoDrawable autoDrawable = null;
-
- private final float[] position = new float[] {0,0,0};
-
- private float xTran = -10;
- private float yTran = 10;
- private float ang = 0f;
- private float zoom = -70f;
- private int texSize = 400;
-
- boolean updateMatrix = true;
- boolean ignoreInput = false;
-
- public GPURendererListenerBase01(Renderer renderer, boolean debug, boolean trace) {
- this.renderer = renderer;
- this.debug = debug;
- this.trace = trace;
- this.screenshot = new Screenshot();
- }
-
- public final Renderer getRenderer() { return renderer; }
- public final float getZoom() { return zoom; }
- public final float getXTran() { return xTran; }
- public final float getYTran() { return yTran; }
- public final float getAngle() { return ang; }
- public final int getTexSize() { return texSize; }
- public final float[] getPosition() { return position; }
-
- public void setMatrix(float xtrans, float ytrans, float angle, int zoom, int fbosize) {
- this.xTran = xtrans;
- this.yTran = ytrans;
- this.ang = angle;
- this.zoom = zoom;
- this.texSize = fbosize;
- updateMatrix = true;
- }
-
- public void init(GLAutoDrawable drawable) {
- autoDrawable = drawable;
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(debug) {
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2ES2();
- }
- if(trace) {
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) ).getGL2ES2();
- }
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- }
-
- public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int width, int height) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- gl.glViewport(xstart, ystart, width, height);
- renderer.reshapePerspective(gl, 45.0f, width, height, 0.1f, 7000.0f);
-
- dumpMatrix();
- }
-
- public void dispose(GLAutoDrawable drawable) {
- autoDrawable = null;
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- screenshot.dispose();
- renderer.dispose(gl);
- }
-
- public void zoom(int v){
- zoom += v;
- updateMatrix = true;
- dumpMatrix();
- }
-
- public void move(float x, float y){
- xTran += x;
- yTran += y;
- updateMatrix = true;
- dumpMatrix();
- }
- public void rotate(float delta){
- ang += delta;
- ang %= 360.0f;
- updateMatrix = true;
- dumpMatrix();
- }
-
- void dumpMatrix() {
- System.err.println("Matrix: " + xTran + "/" + yTran + " x"+zoom + " @"+ang);
- }
-
- /** Attach the input listener to the window */
- public void attachInputListenerTo(GLWindow window) {
- if ( null == keyAction ) {
- keyAction = new KeyAction();
- window.addKeyListener(keyAction);
- }
- }
-
- public void detachFrom(GLWindow window) {
- if ( null == keyAction ) {
- return;
- }
- window.removeGLEventListener(this);
- window.removeKeyListener(keyAction);
- }
-
- public void printScreen(GLAutoDrawable drawable, String dir, String tech, String objName, boolean exportAlpha) throws GLException, IOException {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
- pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), texSize, objName);
-
- String filename = dir + tech + sw +".tga";
- screenshot.surface2File(drawable, filename /*, exportAlpha */);
- }
-
- int screenshot_num = 0;
-
- public void setIgnoreInput(boolean v) {
- ignoreInput = v;
- }
- public boolean getIgnoreInput() {
- return ignoreInput;
- }
-
- public class KeyAction implements KeyListener {
- public void keyPressed(KeyEvent arg0) {
- if(ignoreInput) {
- return;
- }
-
- if(arg0.getKeyCode() == KeyEvent.VK_1){
- zoom(10);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_2){
- zoom(-10);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_UP){
- move(0, -1);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_DOWN){
- move(0, 1);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_LEFT){
- move(1, 0);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_RIGHT){
- move(-1, 0);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_6){
- texSize -= 10;
- System.err.println("Tex Size: " + texSize);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_7){
- texSize += 10;
- System.err.println("Tex Size: " + texSize);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_0){
- rotate(1);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_9){
- rotate(-1);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_V) {
- if(null != autoDrawable) {
- autoDrawable.invoke(false, new GLRunnable() {
- public void run(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- int i = gl.getSwapInterval();
- i = i==0 ? 1 : 0;
- gl.setSwapInterval(i);
- final GLAnimatorControl a = drawable.getAnimator();
- if( null != a ) {
- a.resetCounter();
- }
- System.err.println("Swap Interval: "+i);
- }
- });
- }
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_S){
- rotate(-1);
- if(null != autoDrawable) {
- autoDrawable.invoke(false, new GLRunnable() {
- public void run(GLAutoDrawable drawable) {
- try {
- final String type = ( 1 == renderer.getRenderType() ) ? "r2t0-msaa1" : "r2t1-msaa0" ;
- printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false);
- screenshot_num++;
- } catch (GLException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- });
- }
- }
- }
- public void keyTyped(KeyEvent arg0) {}
- public void keyReleased(KeyEvent arg0) {}
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
deleted file mode 100644
index 7290246d1..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.GL2ES2;
-import javax.media.opengl.GLAutoDrawable;
-
-import com.jogamp.graph.curve.opengl.TextRenderer;
-import com.jogamp.graph.geom.opengl.SVertex;
-
-public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 {
- public GPUTextGLListener0A(int numpass, int fbosize, boolean debug, boolean trace) {
- super(SVertex.factory(), numpass, debug, trace);
- setMatrix(-400, -30, 0f, -500, fbosize);
- }
-
- public void init(GLAutoDrawable drawable) {
- super.init(drawable);
-
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- final TextRenderer textRenderer = (TextRenderer) getRenderer();
-
- gl.setSwapInterval(1);
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- textRenderer.init(gl);
- textRenderer.setAlpha(gl, 1.0f);
- textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f);
- //gl.glSampleCoverage(0.95f, false);
- //gl.glEnable(GL2GL3.GL_SAMPLE_COVERAGE); // sample coverage doesn't really make a difference to lines
- //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE);
- //gl.glEnable(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE);
- MSAATool.dump(drawable);
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
deleted file mode 100644
index 3739f28ea..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo01.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * 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.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-
-public class GPUTextNewtDemo01 {
- static final boolean DEBUG = false;
- static final boolean TRACE = false;
-
- public static void main(String[] args) {
- GLProfile.initSingleton(true);
- GLProfile glp = GLProfile.getGL2ES2();
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- caps.setSampleBuffers(true);
- caps.setNumSamples(4); // 2 samples is not enough ..
- System.out.println("Requested: "+caps);
-
- GLWindow window = GLWindow.create(caps);
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 01 - r2t0 msaa1");
-
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.SINGLE_PASS, 0, DEBUG, TRACE);
- textGLListener.attachInputListenerTo(window);
- window.addGLEventListener(textGLListener);
-
- window.enablePerfLog(true);
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(10);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
deleted file mode 100644
index 40c7d6ac4..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo02.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Animator;
-
-public class GPUTextNewtDemo02 {
- /**
- * 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.initSingleton(true);
- GLProfile glp = GLProfile.getGL2ES2();
-
- GLCapabilities caps = new GLCapabilities(glp);
- caps.setAlphaBits(4);
- System.out.println("Requested: "+caps);
-
- GLWindow window = GLWindow.create(caps);
-
- window.setPosition(10, 10);
- window.setSize(800, 400);
- window.setTitle("GPU Text Newt Demo 02 - r2t1 msaa0");
-
- GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(Region.TWO_PASS, window.getWidth()*3, DEBUG, TRACE);
- textGLListener.attachInputListenerTo(window);
- window.addGLEventListener(textGLListener);
-
- window.enablePerfLog(true);
- window.setVisible(true);
- // FPSAnimator animator = new FPSAnimator(60);
- Animator animator = new Animator();
- animator.add(window);
- animator.start();
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
deleted file mode 100644
index 909f68b85..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/**
- * 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 java.io.IOException;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
-import com.jogamp.graph.curve.opengl.TextRenderer;
-import com.jogamp.graph.font.Font;
-import com.jogamp.graph.font.FontFactory;
-import com.jogamp.graph.geom.AABBox;
-import com.jogamp.graph.geom.Vertex;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.KeyListener;
-import com.jogamp.newt.opengl.GLWindow;
-
-/**
- *
- * GPURendererListenerBase01 Keys:
- * - 1/2: zoom in/out
- * - 6/7: 2nd pass texture size
- * - 0/9: rotate
- * - v: toggle v-sync
- * - s: screenshot
- *
- * Additional Keys:
- * - 3/4: font +/-
- * - h: toogle draw 'font set'
- * - f: toggle draw fps
- * - space: toggle font (ubuntu/java)
- * - i: live input text input (CR ends it, backspace supported)
- */
-public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerBase01 {
- int fontSet = FontFactory.UBUNTU;
- Font font;
-
- boolean drawFontSet = true;
- boolean drawFPS = true;
- boolean updateFont = true;
- int fontSize = 40;
- final int fontSizeModulo = 100;
-
- static final String text1 = "abcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n0123456789.:,;(*!?/\\\")$%^&-+@~#<>{}[]";
- static final String text2 = "The quick brown fox jumps over the lazy dog";
-
- StringBuffer userString = new StringBuffer();
- boolean userInput = false;
-
- public GPUTextRendererListenerBase01(Vertex.Factory<? extends Vertex> factory, int mode, boolean debug, boolean trace) {
- super(TextRenderer.create(factory, mode), debug, trace);
- this.font = FontFactory.get(fontSet).getDefault();
- }
-
- public void display(GLAutoDrawable drawable) {
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // Demo02 needs to have this set here as well .. hmm ?
- gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
- final TextRenderer textRenderer = (TextRenderer) getRenderer();
-
- if(drawFPS || drawFontSet || updateMatrix) {
- final int width = drawable.getWidth();
- final int height = drawable.getHeight();
- final GLAnimatorControl animator = drawable.getAnimator();
- final boolean _drawFPS = drawFPS && null != animator && animator.getTotalFrames()>10;
-
- if(_drawFPS || drawFontSet) {
- textRenderer.reshapeOrtho(null, width, height, 0.1f, 7000.0f);
- }
- if(_drawFPS) {
- final float fps = ( animator.getTotalFrames() * 1000.0f ) / (float) animator.getDuration() ;
- final String fpsS = String.valueOf(fps);
- final int fpsSp = fpsS.indexOf('.');
- textRenderer.resetModelview(null);
- textRenderer.translate(gl, 0, 0, -6000);
- textRenderer.renderString3D(gl, font, fpsS.substring(0, fpsSp+2), getPosition(), fontSize, getTexSize());
- }
- if(drawFontSet) {
- textRenderer.resetModelview(null);
- final AABBox box = font.getStringBounds(font.getName(), fontSize/4);
- final int dx = width-(int)box.getWidth()-2;
- final int dy = height-(int)box.getHeight()-2;
- textRenderer.translate(gl, dx, dy, -6000);
- textRenderer.renderString3D(gl, font, font.getName(), getPosition(), fontSize/4, getTexSize());
- textRenderer.translate(gl, -dx, -20, 0);
- textRenderer.renderString3D(gl, font, text1, getPosition(), fontSize, getTexSize());
- }
- if(_drawFPS || drawFontSet) {
- textRenderer.reshapePerspective(null, 45.0f, width, height, 0.1f, 7000.0f);
- }
-
- textRenderer.resetModelview(null);
- textRenderer.translate(null, getXTran(), getYTran(), getZoom());
- textRenderer.rotate(gl, getAngle(), 0, 1, 0);
- updateMatrix = false;
- }
-
- if(!userInput) {
- textRenderer.renderString3D(gl, font, text2, getPosition(), fontSize, getTexSize());
- } else {
- textRenderer.renderString3D(gl, font, userString.toString(), getPosition(), fontSize, getTexSize());
- }
- }
-
- public void fontIncr(int v) {
- fontSize = Math.abs((fontSize + v) % fontSizeModulo) ;
- updateFont = true;
- dumpMatrix(true);
- }
-
- public void nextFontSet() {
- fontSet = ( fontSet == FontFactory.UBUNTU ) ? FontFactory.JAVA : FontFactory.UBUNTU ;
- font = FontFactory.get(fontSet).getDefault();
- }
-
- public void setFontSet(int set, int family, int stylebits) {
- fontSet = set;
- font = FontFactory.get(fontSet).get(family, stylebits);
- }
-
- public boolean isUserInputMode() { return userInput; }
-
- void dumpMatrix(boolean bbox) {
- System.err.println("Matrix: " + getXTran() + "/" + getYTran() + " x"+getZoom() + " @"+getAngle() +" fontSize "+fontSize);
- if(bbox) {
- System.err.println("bbox: "+font.getStringBounds(text2, fontSize));
- }
- }
-
- KeyAction keyAction = null;
-
- @Override
- public void attachInputListenerTo(GLWindow window) {
- if ( null == keyAction ) {
- keyAction = new KeyAction();
- window.addKeyListener(keyAction);
- super.attachInputListenerTo(window);
- }
-
- }
-
- @Override
- public void detachFrom(GLWindow window) {
- super.detachFrom(window);
- if ( null == keyAction ) {
- return;
- }
- window.removeKeyListener(keyAction);
- }
-
- public void printScreen(GLAutoDrawable drawable, String dir, String tech, boolean exportAlpha) throws GLException, IOException {
- printScreen(drawable, dir, tech, font.getName(), exportAlpha);
- }
-
- public class KeyAction implements KeyListener {
- public void keyPressed(KeyEvent arg0) {
- if(userInput) {
- return;
- }
-
- if(arg0.getKeyCode() == KeyEvent.VK_3){
- fontIncr(10);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_4){
- fontIncr(-10);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_H) {
- drawFontSet = !drawFontSet;
- System.err.println("Draw font set: "+drawFontSet);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_F){
- drawFPS = !drawFPS;
- System.err.println("Draw FPS: "+drawFPS);
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_SPACE) {
- nextFontSet();
- }
- else if(arg0.getKeyCode() == KeyEvent.VK_I){
- userInput = true;
- setIgnoreInput(true);
- }
- }
- public void keyTyped(KeyEvent arg0) {
- if(userInput) {
- char c = arg0.getKeyChar();
-
- System.err.println(arg0);
- if(c == 0x08) {
- userString.deleteCharAt(userString.length()-1);
- } else if(c == 0x0d) {
- userInput = false;
- setIgnoreInput(true);
- } else {
- userString.append(c);
- }
- }
- }
- public void keyReleased(KeyEvent arg0) {}
- }
-} \ No newline at end of file
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
deleted file mode 100644
index 5975e096b..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.GL2ES2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilitiesImmutable;
-
-public class MSAATool {
- public static void dump(GLAutoDrawable drawable) {
- float[] vf = new float[] { 0f };
- byte[] vb = new byte[] { 0 };
- int[] vi = new int[] { 0, 0 };
-
- System.out.println("GL MSAA SETUP:");
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities();
- System.out.println(" Caps realised "+caps);
- System.out.println(" Caps sample buffers "+caps.getSampleBuffers()+", samples "+caps.getNumSamples());
-
- // default TRUE
- System.out.println(" GL MULTISAMPLE "+gl.glIsEnabled(GL2ES2.GL_MULTISAMPLE));
- // sample buffers min 0, same as GLX_SAMPLE_BUFFERS_ARB or WGL_SAMPLE_BUFFERS_ARB
- gl.glGetIntegerv(GL2GL3.GL_SAMPLE_BUFFERS, vi, 0);
- // samples min 0
- gl.glGetIntegerv(GL2GL3.GL_SAMPLES, vi, 1);
- System.out.println(" GL SAMPLE_BUFFERS "+vi[0]+", SAMPLES "+vi[1]);
-
- System.out.println("GL CSAA SETUP:");
- // default FALSE
- System.out.println(" GL SAMPLE COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE));
- // default FALSE
- System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE));
- // default FALSE
- System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_ALPHA_TO_ONE));
- // default FALSE, value 1, invert false
- gl.glGetFloatv(GL2GL3.GL_SAMPLE_COVERAGE_VALUE, vf, 0);
- gl.glGetBooleanv(GL2GL3.GL_SAMPLE_COVERAGE_INVERT, vb, 0);
- System.out.println(" GL SAMPLE_COVERAGE "+gl.glIsEnabled(GL2GL3.GL_SAMPLE_COVERAGE) +
- ": SAMPLE_COVERAGE_VALUE "+vf[0]+
- ", SAMPLE_COVERAGE_INVERT "+vb[0]);
- }
-}
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/ReadBufferUtil.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/ReadBufferUtil.java
deleted file mode 100644
index 172eef4fc..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/ReadBufferUtil.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * 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 com.jogamp.opengl.util.GLBuffers;
-import java.nio.*;
-import javax.media.opengl.*;
-
-import com.jogamp.opengl.util.texture.Texture;
-import com.jogamp.opengl.util.texture.TextureData;
-
-public class ReadBufferUtil {
- protected int readPixelSizeLast = 0;
- protected Buffer readPixelBuffer = null;
- protected TextureData readTextureData = null;
- protected Texture readTexture = new Texture(GL.GL_TEXTURE_2D);
-
- public Buffer getPixelBuffer() { return readPixelBuffer; }
- public void rewindPixelBuffer() { readPixelBuffer.rewind(); }
-
- public TextureData getTextureData() { return readTextureData; }
- public Texture getTexture() { return readTexture; }
-
- public boolean isValid() {
- return null!=readTexture && null!=readTextureData && null!=readPixelBuffer ;
- }
-
- public void fetchOffscreenTexture(GLDrawable drawable, GL gl) {
- int readPixelSize = drawable.getWidth() * drawable.getHeight() * 3 ; // RGB
- boolean newData = false;
- if(readPixelSize>readPixelSizeLast) {
- readPixelBuffer = GLBuffers.newDirectGLBuffer(GL.GL_UNSIGNED_BYTE, readPixelSize);
- readPixelSizeLast = readPixelSize ;
- try {
- readTextureData = new TextureData(
- gl.getGLProfile(),
- // gl.isGL2GL3()?gl.GL_RGBA:gl.GL_RGB,
- GL.GL_RGB,
- drawable.getWidth(), drawable.getHeight(),
- 0,
- GL.GL_RGB,
- GL.GL_UNSIGNED_BYTE,
- false, false,
- false /* flip */,
- readPixelBuffer,
- null /* Flusher */);
- newData = true;
- } catch (Exception e) {
- readTextureData = null;
- readPixelBuffer = null;
- readPixelSizeLast = 0;
- throw new RuntimeException("can not fetch offscreen texture", e);
- }
- }
- if(null!=readPixelBuffer) {
- readPixelBuffer.clear();
- gl.glReadPixels(0, 0, drawable.getWidth(), drawable.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, readPixelBuffer);
- readPixelBuffer.rewind();
- if(newData) {
- readTexture.updateImage(readTextureData);
- } else {
- readTexture.updateSubImage(readTextureData, 0,
- 0, 0, // src offset
- 0, 0, // dst offset
- drawable.getWidth(), drawable.getHeight());
- }
- readPixelBuffer.rewind();
- }
- }
-
- @SuppressWarnings("deprecation")
- public void dispose() {
- readTexture.dispose();
- readTextureData = null;
- if(null != readPixelBuffer) {
- readPixelBuffer.clear();
- readPixelBuffer = null;
- }
- readPixelSizeLast = 0;
- }
-
-}
-
diff --git a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/Screenshot.java b/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/Screenshot.java
deleted file mode 100644
index e0c304e49..000000000
--- a/turtle2d/src/com/jogamp/opengl/test/junit/graph/demos/Screenshot.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.jogamp.opengl.test.junit.graph.demos;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-
-import com.jogamp.opengl.util.texture.TextureIO;
-
-public class Screenshot {
-
- ReadBufferUtil readBufferUtil = new ReadBufferUtil();
-
- public void dispose() {
- readBufferUtil.dispose();
- }
-
- public void surface2File(GLAutoDrawable drawable, String filename) {
- GL gl = drawable.getGL();
- // FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec
- gl.glFinish();
- readBufferUtil.fetchOffscreenTexture(drawable, gl);
- gl.glFinish();
- try {
- surface2File(filename);
- } catch (IOException ex) {
- throw new RuntimeException("can not write survace to file", ex);
- }
- }
-
- void surface2File(String filename) throws IOException {
- File file = new File(filename);
- TextureIO.write(readBufferUtil.getTextureData(), file);
- System.err.println("Wrote: " + file.getAbsolutePath() + ", ...");
- readBufferUtil.rewindPixelBuffer();
- }
-
-}