I have a problem using copy() in OPENGL:
I'm trying to store a detail of a large bitmap in a small PImage. The example code below works as expected in P3D rendering mode, but with OPENGL the copy() function seems to work only once - in subsequent frames, copy() does not have any effect on what's drawn to the display window.
Is this a bug or is there a way to refresh the bitmap that's drawn to the screen? Your advice would be appreciated.
(I'm using 0090 on OS X 10.3.9)
Code:
import processing.opengl.*;
PImage detail, img;
void setup() {
size(200, 200, OPENGL); //works fine with P3D
detail = new PImage(200, 200);
img = loadImage("img.jpg");
}
void draw() {
int startX = round((random(img.width - detail.width)));
int startY = round((random(img.height - detail.height)));
detail.copy(img,
startX, startY, detail.width, detail.height,
0, 0, detail.width, detail.height);
image(detail, 0, 0);
}