More fixes to the resource backup/(re)allocation/restore mechanism

This commit is contained in:
codeanticode
2011-07-02 10:18:14 +00:00
parent a6b7b7e84b
commit 3ee4bc6248
2 changed files with 15 additions and 13 deletions
@@ -154,11 +154,10 @@ public class PFramebuffer implements PConstants {
}
public void backup() {
}
public void restore() {
setColorBuffers(colorBufferTex.clone(), colorBufferTex.length);
setColorBuffers(colorBufferTex.clone(), colorBufferTex.length);
}
public void clear() {
@@ -2212,19 +2212,20 @@ public class PShape3D extends PShape {
numTexBuffers = 1;
firstVertex = 0;
lastVertex = numVert - 1;
lastVertex = numVert - 1;
initVertexData();
initColorData();
initNormalData();
initTexCoordData();
}
protected void allocate() {
release(); // Just in the case this object is being re-allocated.
initVertexData();
createVertexBuffer();
initColorData();
createColorBuffer();
initNormalData();
createNormalBuffer();
initTexCoordData();
createVertexBuffer();
createColorBuffer();
createNormalBuffer();
createTexCoordBuffer();
}
@@ -2385,8 +2386,10 @@ public class PShape3D extends PShape {
protected void deleteTexCoordBuffer() {
for (int i = 0; i < glTexCoordBufferID.length; i++) {
deleteTexCoordBuffer(i);
if (glTexCoordBufferID != null) {
for (int i = 0; i < glTexCoordBufferID.length; i++) {
deleteTexCoordBuffer(i);
}
}
}