3D Shapes

v0.1.7
plane(w, h);

Draw a plane.

Arguments

wThe width dimension
hThe height dimension

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
 
  plane(400, 400);
end

Output

See plane in shapes3D.h
box(w, [h], [d]);

Draw a 3D box.

Arguments

wThe width dimension
[h]The height dimension
[d]The depth dimension

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
 
  box(150, 225, 180);
end

Output

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
  
  rotateX(45);
  rotateZ(45);

  box(150, 225, 180);
end

Output

See box in shapes3D.h
sphere(w, [detailX], [detailY]);

Draw a 3D Sphere.

Arguments

wThe width dimension
[detailX]The detail in the X axis
[detailY]the detailt in the Y axis

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
 
  sphere(200);
end

Output

See sphere in shapes3D.h
cylinder([radius], [height], [detailX], [detailY], [bottomCap], [topCap]);

Draw a 3D Cylinder.

Arguments

[radius]radius of the cylinder. Defaults to 50.
[height]height of the cylinder. Defaults to the value of radius.
[detailX]number of horizontal edges. Defaults to 24.
[detailY]number of subdivisions along the y
[bottomCap]whether to draw the cylinder
[topCap]whether to draw the cylinder

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
 
  cylinder(80, 140);
end

Output

See cylinder in shapes3D.h
torus([radius], [tubeRadius], [detailX], [detailY]);

Draw a 3D Torus.

Arguments

[radius]radius of the torus. Defaults to 50.
[tubeRadius]radius of the tube. Defaults to 10.
[detailX]number of edges that form the hole. Defaults to 24.
[detailY]number of triangle subdivisions along the y

function setup()
  createWindow(300, 300, GL3D);
end

function draw()
  background('purple');
 
  torus(180, 80);
end

Output

See torus in shapes3D.h