Vit Ap University, Andhra Pradesh: Lab Sheet 11: Perspective View
Vit Ap University, Andhra Pradesh: Lab Sheet 11: Perspective View
OUTPUT:
(b) Cylinder
function setup() {
createCanvas(400, 400, WEBGL);
perspective(PI / 3.0, width / height, 1, 500);
}
function draw() {
background(0);
fill('yellow');
stroke(1);
lights();
rotateX(-0.3);
rotateY(-0.3);
translate(0, 0, -50);
push();
translate(-15, 0, sin(1000/ 30) * 95);
cylinder(50,100);
pop();
OUTPUT:
(B) Two point Perspective:
CODE:
(a) Cube
function setup() {
createCanvas(400, 400, WEBGL);
perspective(PI / 4.0, width / height, 1, 500);
}
function draw() {
background(0);
fill('red');
stroke(1);
lights();
rotateX(-0.3)
rotateY(-0.7);
translate(50, -10, -50);
push();
translate(-15, 0, sin(1000/ 30) * 95);
box(100);
pop();
}
OUTPUT:
(b)Cylinder
function setup() {
createCanvas(400, 400, WEBGL);
perspective(PI / 3.0, width / height, 1, 500);
}
function draw() {
background(0);
fill('red');
stroke(1);
lights();
rotateX(-0.3)
rotateY(-0.7);
translate(50, -10, -50);
push();
translate(-15, 0, sin(1000/ 30) * 95);
cylinder(50,100)
pop();
}
OUTPUT: