smooth vertices in P3D? (increased strokeweight)
in
Programming Questions
•
6 months ago
hey everybody!
my first post in this forum ;D
I have a simple pyramid shape in 3D, with increased strokeweight. (Taken from
http://processing.org/learning/p3d/ under 3d shapes). Now the vertices look edgy, not smooth or "straight" as I'd like them to be. What can I do?
I've already tried "smooth()" but it doesn't seem to do anything.
Thanks in advance!
This program should run as it is, try pressing X, Y or Z key to rotate the pyramid.
- void setup() {
- size(800, 600, P3D);
- smooth();
- }
- float x=0;
- float y=0;
- float z=0;
- void draw() {
- background(255,0,0);
- strokeWeight(20);
- translate(width/2, height/2, 0);
- rotateX(x);
- rotateY(y);
- rotateZ(z);
- scale(100);
- beginShape();
- vertex(-1, -1, -1);
- vertex( 1, -1, -1);
- vertex( 0, 0, 1);
- vertex( 1, -1, -1);
- vertex( 1, 1, -1);
- vertex( 0, 0, 1);
- vertex( 1, 1, -1);
- vertex(-1, 1, -1);
- vertex( 0, 0, 1);
- vertex(-1, 1, -1);
- vertex(-1, -1, -1);
- vertex( 0, 0, 1);
- endShape();
- if(keyPressed && key=='x')x = x + 0.01;
- if(keyPressed && key=='y')y = y + 0.01;
- if(keyPressed && key=='z')z = z + 0.01;
- }
1