From 62f03a14e2f1447ad33352ea74d5654a8922936e Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 14 Mar 2011 14:31:26 +0000 Subject: [PATCH] tess hack --- .../processing/opengl/PGraphicsOpenGL.java | 54 +++++++++++++++++++ todo.txt | 18 ++++--- 2 files changed, 66 insertions(+), 6 deletions(-) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index 1444ace02..53a2391fd 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -31,6 +31,7 @@ import java.awt.geom.*; import java.io.*; import java.lang.reflect.Field; import java.nio.*; +import java.util.ArrayList; import javax.media.opengl.*; import javax.media.opengl.glu.*; @@ -1764,6 +1765,55 @@ public class PGraphicsOpenGL extends PGraphics3D { } */ + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + // tessellation hack, allows you to steal polygon data + + + public void tessBegin() { + glu.gluTessBeginPolygon(tobj, null); + } + + public void tessVertex(float x, float y) { + double[] vertex = new double[] { x, y, 0 }; + glu.gluTessVertex(tobj, vertex, 0, vertex); + } + + public void tessBreak() { + glu.gluTessEndContour(tobj); + } + + public void tessEnd() { + glu.gluTessEndPolygon(tobj); + } + + + public class TessInfo { + public int tessShape; + public int tessCount; + public float[] tessPoints; + + public TessInfo() { + tessShape = shape; + tessCount = vertexCount; + tessPoints = new float[vertexCount * 2]; + for (int i = 0; i < vertexCount; i++) { + tessPoints[i*2 + 0] = vertices[i][X]; + tessPoints[i*2 + 1] = vertices[i][Y]; + } + } + } + public ArrayList tessInfo = new ArrayList(); + public boolean tessInfoEnabled = false; + + public void tessInfoReset() { + tessInfo.clear(); + } + + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + public class TessCallback extends GLUtessellatorCallbackAdapter { public void begin(int type) { @@ -1775,6 +1825,10 @@ public class PGraphicsOpenGL extends PGraphics3D { } public void end() { + if (tessInfoEnabled) { + tessInfo.add(new TessInfo()); + } + //gl.glEnd(); endShape(); } diff --git a/todo.txt b/todo.txt index c5c74d365..d3b08d7a4 100644 --- a/todo.txt +++ b/todo.txt @@ -9,10 +9,16 @@ X http://code.google.com/p/processing/issues/detail?id=551 X found issue where editor objects were being kept around after closing X with 1 editor open, the editors array wasn't being cleared X (before default file menu, there was no point) +X with one sketch open, changing the mode doesn't close the original editor +X only affects linux and windows +X http://code.google.com/p/processing/issues/detail?id=569 +X move library examples to the examples menu +o do this once the library documentation has been fixed up +X http://dev.processing.org/bugs/show_bug.cgi?id=1278 +X http://code.google.com/p/processing/issues/detail?id=181 -_ with one sketch open, changing the mode doesn't close the original editor -_ only affects linux and windows -_ http://code.google.com/p/processing/issues/detail?id=569 +_ "No library found" message when using import statements and the code folder +_ http://code.google.com/p/processing/issues/detail?id=568 earlier X Unsatisfied Link Error running OPENGL on 64-bit ubuntu @@ -359,13 +365,13 @@ _ save sketch zip files _ have a means to load them from "teacher" version of p5 _ figure out how to use the +version 2.0 _ add proper copyright and license information for all included projects _ http://code.google.com/p/processing/issues/detail?id=185 +_ list of license issues +_ http://code.google.com/p/processing/issues/detail?id=575 _ need an "install library" option to deal with urls.. oy -_ move library examples to the examples menu -_ do this once the library documentation has been fixed up -_ http://dev.processing.org/bugs/show_bug.cgi?id=1278 _ proper libraries warning dialog _ check if libraries folder does not exist _ check to see if other libraries are installed