Flipcard (based on Topics/Textures/TextureQuad example) Front and Back

Hi,

I got it working but I am not sure I understand why… :frowning:
I had to add a 2nd translation to each PShape quad before displaying them with shape(). What I don’t understand is that that 2nd translation in both cases is:
translate(0, 0, -2); for the one in the back
translate(0, 0, -2); for the one in the front

When I removed the second translations and added that Z value in the last argument of the 1st translation, it does not work. What is the need for the second translation?
This is super odd, I solved it, but I do not understand why, so I am back at square one.

Here is my new reduced / working void draw():

Thank you for looking.

void draw() {
  background(0);

  //START shape quadIN
  push();
  translate(width/2, height/2, 0);  //===> 1st translation
  rotateY(radians(frameCount*0.5));
  translate(0, 0, -10);      //===> 2nd translation
  shape(quadIN, 0, 0);
  pop();
  //END shape quadIN

  //START shape quadOUT
  push();
  translate(width/2, height/2, 0);   //===> 1st translation
  rotateY(radians(frameCount*0.5));
  translate(0, 0, 10);    //===> 2nd translation
  shape(quadOUT, 0, 0);
  pop();
  //END shape quadOUT
}
1 Like