mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
android sync
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user