In processing.js, how would you overlay an image over another one in P3D mode?
Here is my code:
/* @pjs preload="duck.jpg"; */
/* @pjs preload="a.png"; */
PImage imageDuck;
PImage imageA;
void setup() {
size(500, 500, P3D);
imageDuck = loadImage("duck.jpg");
imageA = loadImage("a.png");
}
void draw() {
background(255);
noStroke();
image(imageDuck, 0, 0);
image(imageA, 0, 0);
}
So what the code trying to do is to display a duck image, then overlay another image name a.png (with transparent background) on top of it.
When I use the normal size(500, 500); without the P3D mode, the image overlay works perfectly.
However, I am using P3D because the next thing I am going to do is to rotate my images together.
So in this size(500, 500, P3D) mode, I can see my a.png flashed once, then only my duck image shows. If I comment out duck, a.png will show. If I comment out a.png, my duck shows. If I reorder the image() call, still only the duck image shows. I added translate(0,0,-1) or translate(0,0,1) in between my image() calls, no luck, only my duck image shows.
Is this even possible?