diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 88164f43e1..b00fa43f92 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -5512,8 +5512,11 @@ protected void setImpl(PImage sourceImage, int targetX, int targetY) { updatePixelSize(); - // Copies the pixels + // make sure pixel arrays are available loadPixels(); + sourceImage.loadPixels(); + + // Copies the pixels int sourceOffset = sourceY * sourceImage.pixelWidth + sourceX; int targetOffset = targetY * pixelWidth + targetX; for (int y = sourceY; y < sourceY + sourceHeight; y++) {