diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index d8ca1fe6d..276f1ae14 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -1508,7 +1508,7 @@ public class PApplet extends Activity implements PConstants, Runnable { if (g instanceof PGraphicsAndroid3D) { // TODO: Check why textures doesn't work in formats other than ARGB... image.format = ARGB; - image.initTexture(); + image.loadTexture(); } return image; } @@ -1520,7 +1520,7 @@ public class PApplet extends Activity implements PConstants, Runnable { if (g instanceof PGraphicsAndroid3D) { // TODO: Check why textures doesn't work in formats other than ARGB... image.format = ARGB; - image.initTexture(filter); + image.loadTexture(filter); } return image; } @@ -1532,7 +1532,7 @@ public class PApplet extends Activity implements PConstants, Runnable { if (g instanceof PGraphicsAndroid3D) { // TODO: Check why textures doesn't work in formats other than ARGB... image.format = params.format; - image.initTexture(params); + image.loadTexture(params); } return image; } @@ -3313,7 +3313,7 @@ public class PApplet extends Activity implements PConstants, Runnable { if (g instanceof PGraphicsAndroid3D) { // TODO: Check why textures doesn't work in formats other than ARGB... image.format = ARGB; - image.initTexture(); + image.loadTexture(); } return image; } diff --git a/android/core/src/processing/core/PGraphicsAndroid3D.java b/android/core/src/processing/core/PGraphicsAndroid3D.java index e1483ad6e..d719aab9f 100644 --- a/android/core/src/processing/core/PGraphicsAndroid3D.java +++ b/android/core/src/processing/core/PGraphicsAndroid3D.java @@ -4771,7 +4771,7 @@ public class PGraphicsAndroid3D extends PGraphics { public void loadTexture() { if (texture == null) { - initTexture(NEAREST); + loadTexture(NEAREST); texture.setFlippedY(true); } diff --git a/android/core/src/processing/core/PImage.java b/android/core/src/processing/core/PImage.java index 5be3d03eb..fbe0f064f 100644 --- a/android/core/src/processing/core/PImage.java +++ b/android/core/src/processing/core/PImage.java @@ -191,19 +191,19 @@ public class PImage implements PConstants, Cloneable { } - public void initTexture() { + public void loadTexture() { texture = new PTexture(parent, width, height, new PTexture.Parameters(format)); pixelsToTexture(); } - public void initTexture(int filter) { + public void loadTexture(int filter) { texture = new PTexture(parent, width, height, new PTexture.Parameters(format, filter)); pixelsToTexture(); } - public void initTexture(PTexture.Parameters params) { + public void loadTexture(PTexture.Parameters params) { texture = new PTexture(parent, width, height, params); pixelsToTexture(); } @@ -518,6 +518,11 @@ public class PImage implements PConstants, Cloneable { index2 += w; } } + if (parent.g instanceof PGraphicsAndroid3D) { + // TODO: Check why textures doesn't work in formats other than ARGB... + newbie.format = ARGB; + newbie.loadTexture(); + } return newbie; } @@ -527,7 +532,13 @@ public class PImage implements PConstants, Cloneable { */ public PImage get() { try { - return (PImage) clone(); + PImage img = (PImage) clone(); + if (parent.g instanceof PGraphicsAndroid3D) { + // TODO: Check why textures doesn't work in formats other than ARGB... + img.format = ARGB; + img.loadTexture(); + } + return img; } catch (CloneNotSupportedException e) { return null; }