Loading...
Logo
Processing Forum
bonzvisual's Profile
1 Posts
0 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    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.

    1. void setup() {
    2. size(800, 600, P3D); 
    3. smooth();
    4. }

    5.   float x=0;
    6.   float y=0;
    7.   float z=0;

    8. void draw() {
    9.   background(255,0,0);
    10.   strokeWeight(20);
    11.   
    12.   translate(width/2, height/2, 0);
    13.   rotateX(x);
    14.   rotateY(y);
    15.   rotateZ(z);
    16.   scale(100);

    17.   beginShape();
    18.   vertex(-1, -1, -1);
    19.   vertex( 1, -1, -1);
    20.   vertex( 0,  0,  1);

    21.   vertex( 1, -1, -1);
    22.   vertex( 1,  1, -1);
    23.   vertex( 0,  0,  1);

    24.   vertex( 1, 1, -1);
    25.   vertex(-1, 1, -1);
    26.   vertex( 0, 0,  1);

    27.   vertex(-1,  1, -1);
    28.   vertex(-1, -1, -1);
    29.   vertex( 0,  0,  1);
    30.   endShape();

    31.   if(keyPressed && key=='x')x = x + 0.01;
    32.   if(keyPressed && key=='y')y = y + 0.01;
    33.   if(keyPressed && key=='z')z = z + 0.01;
    34. }