Hey folks. I'm trying to use blend() to display images with additive color, but am having trouble grok'ing the coordinate system. I'm sure I'm doing something silly.
For example:
Code:import processing.opengl.*;
import javax.media.opengl.*;
PImage img;
void setup() {
size(600,600, OPENGL);
img = createImage(10, 10, RGB);
float md = 0.5*sqrt(sq(img.width/2)+sq(img.height/2));
for (int x = 0; x < img.width; x++) {
for (int y = 0; y < img.height; y++) {
float d = sqrt(sq(x-img.width/2)+sq(y-img.height/2));
img.set(x ,y , color(0, 128-128*d/md, 0));
}
}
}
void draw()
{
background(0);
// image "A" -- smaller
blend(img,
0, 0,
img.width, img.height,
0, 0, //x & y of new image
50, 50, //width & height of new image
BLEND);
// image "B" - larger
blend(img,
0, 0,
img.width, img.height,
0, 0, //x & y of new image
100, 100, //width & height of new image
BLEND);
}
Image "A" appears about where I expect -- upper left corner at (0, 0) with bottom right at (50, 50).
Image "B" however, appears with the y coordinate flipped: the upper left corner is at (0, 500) (i.e., height-100) with the bottom at (100, 600).
If I use Image(), the image is placed where I expect, but if multiple images appear on top of one another, there's no visual indication.
Forgive the ignorance, and thanks for the help!
jjguy