ahh! thanks! - should have read the prev. posts more carefully!
so, i've got this working now:
Code:
PImage pattern;
PGraphics canvas;
void setup(){
size(200, 200);
pattern = loadImage("a_pattern.jpg");
canvas = createGraphics(160, 160, JAVA2D);
canvas.noStroke();
canvas.tint(255);
}
void draw(){
background(200, 80, 0);
image(pattern, 5, 5);
updateCanvas();
image(canvas, 20, 20);
}
void updateCanvas(){
canvas.beginDraw();
//canvas.loadPixels(); // need this if P3D is set in size()
canvas.background(33, 125, 180);
canvas.image(pattern, mouseX-20, mouseY-20);
canvas.modified = true;
canvas.endDraw();
}
...but - unfortunately this doesn't quite solve my problem. I failed to mention that size() needs to be
OPENGL since I am using some GL_ stuff in my app.
modifying the code above to use OPENGL causes this error:
java.lang.ClassCastException: processing.opengl.PGraphicsOpenGL$ImageCachecode looks like this:
Code:
import processing.opengl.*;
PImage pattern;
PGraphics canvas;
void setup(){
size(200, 200, OPENGL);
pattern = loadImage("a_pattern.jpg");
canvas = createGraphics(160, 160, JAVA2D);
canvas.noStroke();
canvas.tint(255);
}
void draw(){
background(200, 80, 0);
image(pattern, 5, 5);
updateCanvas();
image(canvas, 20, 20);
}
void updateCanvas(){
canvas.beginDraw();
//canvas.loadPixels(); // need this if P3D is set in size()
canvas.background(33, 125, 180);
canvas.image(pattern, mouseX-20, mouseY-20);
canvas.modified = true;
canvas.endDraw();
}
...seems like OPENGL and JAVA2D doesn't like each other much!
any ideas/suggestions/links?
+ m