android sync

This commit is contained in:
codeanticode
2012-05-03 22:24:45 +00:00
parent 5f935f7ed2
commit 0c150ba131
21 changed files with 6466 additions and 4228 deletions

View File

@@ -103,6 +103,7 @@ public class PTexture implements PConstants {
pg = (PGraphicsOpenGL)parent.g;
pgl = pg.pgl;
context = pgl.createEmptyContext();
glID = 0;
@@ -113,7 +114,7 @@ public class PTexture implements PConstants {
protected void finalize() throws Throwable {
try {
if (glID != 0) {
pg.finalizeTextureObject(glID);
pg.finalizeTextureObject(glID, context.code());
}
} finally {
super.finalize();
@@ -755,8 +756,8 @@ public class PTexture implements PConstants {
pgl.enableTexturing(glTarget);
context = pgl.getContext();
glID = pg.createTextureObject();
context = pgl.getCurrentContext();
glID = pg.createTextureObject(context.code());
pgl.glBindTexture(glTarget, glID);
pgl.glTexParameterf(glTarget, PGL.GL_TEXTURE_MIN_FILTER, glMinFilter);
@@ -781,7 +782,7 @@ public class PTexture implements PConstants {
*/
protected void release() {
if (glID != 0) {
pg.finalizeTextureObject(glID);
pg.finalizeTextureObject(glID, context.code());
glID = 0;
}
}
@@ -790,6 +791,13 @@ public class PTexture implements PConstants {
protected boolean contextIsOutdated() {
boolean outdated = !pgl.contextIsCurrent(context);
if (outdated) {
// Removing the texture object from the renderer's list so it
// doesn't get deleted by OpenGL. The texture object was
// automatically disposed when the old context was destroyed.
pg.removeTextureObject(glID, context.code());
// And then set the id to zero, so it doesn't try to be
// deleted when the object's finalizer is invoked by the GC.
glID = 0;
}
return outdated;