diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index a6e70a86a..12c6fe413 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -6250,11 +6250,15 @@ public class PGraphicsOpenGL extends PGraphics { protected void updateTexture(PImage img, Texture tex) { if (tex != null) { - int x = img.getModifiedX1(); - int y = img.getModifiedY1(); - int w = img.getModifiedX2() - x; - int h = img.getModifiedY2() - y; - tex.set(img.pixels, x, y, w, h, img.format); + if (img.isModified()) { + int x = img.getModifiedX1(); + int y = img.getModifiedY1(); + int w = img.getModifiedX2() - x; + int h = img.getModifiedY2() - y; + tex.set(img.pixels, x, y, w, h, img.format); + } else if (img.isLoaded()) { + tex.set(img.pixels, 0, 0, img.width, img.height, img.format); + } } img.setModified(false); img.setLoaded(false); diff --git a/core/src/processing/opengl/Texture.java b/core/src/processing/opengl/Texture.java index db3c165e9..5ffd60b0b 100644 --- a/core/src/processing/opengl/Texture.java +++ b/core/src/processing/opengl/Texture.java @@ -329,8 +329,7 @@ public class Texture implements PConstants { return; } - if (pixels.length == 0) { - // Nothing to do (means that w == h == 0) but not an erroneous situation + if (pixels.length == 0 || w == 0 || h == 0) { return; }