Adding a top to some sides in 3d
in
Programming Questions
•
1 year ago
Hi everyone, I'm sure this is really simple but I can't seem to work it out. I've made two sides to a box in 3d facing each other and would like to add a top and a bottom to it (no sides). I entered what I thought would be the correct code to add a top and I ended up with something a little odd:
- import peasy.*;
- PeasyCam theCamera;
- void setup() {
- size(1000,500,P3D);
- background(#FCFF50);
- theCamera = new PeasyCam(this, 100);
- }
- void draw(){
- background (#FCFF50);
- fill(0, 50);
- beginShape(QUADS);
- vertex(1,0,0); // Side 1
- vertex(1,10,0);
- vertex(10,10,0);
- vertex(10,0,0);
- vertex(1,0,-10); // Side 2
- vertex(1,10,-10);
- vertex(10,10,-10);
- vertex(10,0,-10);
- vertex(1,0,0); // I hoped that this section would add a top to the sides but no joy.
- vertex(10,0,0);
- vertex(1,0,-10);
- vertex(10,0,-10);
- endShape();
- }
Any idea why this doesn't form a square on top of the 2 sides? Many thanks.
1