Fixed context and edge init in PShape3D

This commit is contained in:
codeanticode
2012-03-31 19:42:16 +00:00
parent d49a72aba7
commit ce64c2e5ff
4 changed files with 36 additions and 18 deletions
@@ -6122,6 +6122,7 @@ public class PGraphicsOpenGL extends PGraphics {
public int[] emissive;
public float[] shininess;
// TODO: this should probably go in the TessGeometry class
public int[][] edges;
// For later, to be used by libraries...
@@ -6138,6 +6139,12 @@ public class PGraphicsOpenGL extends PGraphics {
edgeCount = firstEdge = lastEdge = 0;
}
public void clearEdges() {
edgeCount = firstEdge = lastEdge = 0;
}
public void allocate() {
codes = new int[PGL.DEFAULT_IN_VERTICES];
vertices = new float[3 * PGL.DEFAULT_IN_VERTICES];
@@ -2468,6 +2468,7 @@ public class PShape3D extends PShape {
} else {
if (shapeEnded) {
if (tessellated) {
in.clearEdges();
tess.clear();
}
@@ -2836,6 +2837,8 @@ public class PShape3D extends PShape {
aggregateImpl();
context = pgl.getContext();
// Now that we know, we can initialize the buffers with the correct size.
if (0 < tess.fillVertexCount && 0 < tess.fillIndexCount) {
initFillBuffers(tess.fillVertexCount, tess.fillIndexCount);
@@ -3084,8 +3087,6 @@ public class PShape3D extends PShape {
int sizei = nvert * PGL.SIZEOF_INT;
int sizex = nind * PGL.SIZEOF_INDEX;
context = pgl.getContext();
glFillVertexBufferID = pg.createVertexBufferObject();
pgl.glBindBuffer(PGL.GL_ARRAY_BUFFER, glFillVertexBufferID);
pgl.glBufferData(PGL.GL_ARRAY_BUFFER, 3 * sizef, null, glMode);
@@ -4137,13 +4138,14 @@ public class PShape3D extends PShape {
protected BufferedReader getBufferedReader(String filename) {
//BufferedReader retval = papplet.createReader(filename);
BufferedReader retval = null;
if (retval != null) {
return retval;
} else {
PApplet.println("Could not find this file " + filename);
return null;
}
// BufferedReader retval = null;
// if (retval != null) {
// return retval;
// } else {
// PApplet.println("Could not find this file " + filename);
// return null;
// }
return null;
}