texture cache is not used in retained mode

This commit is contained in:
codeanticode
2012-05-20 02:54:25 +00:00
parent 152fc4b1c3
commit 7789ac5ca2
3 changed files with 30 additions and 25 deletions
@@ -27,7 +27,6 @@ public class PGraphics2D extends PGraphicsOpenGL {
public PGraphics2D() {
super();
// hints[ENABLE_ACCURATE_2D] = true;
hints[ENABLE_PERSPECTIVE_CORRECTED_LINES] = false;
}
@@ -2366,6 +2366,7 @@ public class PGraphicsOpenGL extends PGraphics {
tessellator.setStrokeWeight(strokeWeight);
tessellator.setStrokeCap(strokeCap);
tessellator.setStrokeJoin(strokeJoin);
tessellator.setTexCache(texCache, textureImage0, textureImage);
if (stroke && defaultEdges && edges == null) inGeo.addTrianglesEdges();
if (normalMode == NORMAL_MODE_AUTO) inGeo.calcTrianglesNormals();
@@ -2403,19 +2404,19 @@ public class PGraphicsOpenGL extends PGraphics {
}
}
if (hasPoints) {
flushPoints();
if (raw != null) {
rawPoints();
}
}
if (hasLines) {
flushLines();
if (raw != null) {
rawLines();
}
}
if (hasPoints) {
flushPoints();
if (raw != null) {
rawPoints();
}
}
if (flushMode == FLUSH_WHEN_FULL && !hints[DISABLE_TRANSFORM_CACHE]) {
popMatrix();
@@ -10556,15 +10557,19 @@ public class PGraphicsOpenGL extends PGraphics {
}
void setFirstTexIndex(int firstIndex, int firstCache) {
firstTexIndex = firstIndex;
firstTexCache = PApplet.max(0, firstCache);
if (texCache != null) {
firstTexIndex = firstIndex;
firstTexCache = PApplet.max(0, firstCache);
}
}
void setLastTexIndex(int lastIndex, int lastCache) {
if (prevTexImage != newTexImage || texCache.size == 0) {
texCache.addTexture(newTexImage, firstTexIndex, firstTexCache, lastIndex, lastCache);
} else {
texCache.setLastIndex(lastIndex, lastCache);
if (texCache != null) {
if (prevTexImage != newTexImage || texCache.size == 0) {
texCache.addTexture(newTexImage, firstTexIndex, firstTexCache, lastIndex, lastCache);
} else {
texCache.setLastIndex(lastIndex, lastCache);
}
}
}
@@ -2539,7 +2539,8 @@ public class PShapeOpenGL extends PShape {
tessellator.setStrokeColor(strokeColor);
tessellator.setStrokeWeight(strokeWeight);
tessellator.setStrokeCap(strokeCap);
tessellator.setStrokeJoin(strokeJoin);
tessellator.setStrokeJoin(strokeJoin);
tessellator.setTexCache(null, null, null);
if (family == GEOMETRY) {
// The tessellation maps are used to associate input
@@ -4014,13 +4015,13 @@ public class PShapeOpenGL extends PShape {
// Some error. Root should never be null. At least it should be this.
return;
}
if (havePoints) {
renderPoints(g);
if (haveFill) {
renderFill(g, texture);
if (g.haveRaw()) {
rawPoints(g);
}
}
rawFill(g, texture);
}
}
if (haveLines) {
renderLines(g);
@@ -4029,11 +4030,11 @@ public class PShapeOpenGL extends PShape {
}
}
if (haveFill) {
renderFill(g, texture);
if (havePoints) {
renderPoints(g);
if (g.haveRaw()) {
rawFill(g, texture);
}
rawPoints(g);
}
}
}