0% found this document useful (0 votes)
67 views7 pages

Vit Ap University, Andhra Pradesh: Lab Sheet 11: Perspective View

The document provides code examples to illustrate one-point and two-point perspective views in OpenGL. For one-point perspective, it shows code to render a cube and cylinder. For two-point perspective, it also shows code to render a cube and cylinder with adjusted perspective and translation values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views7 pages

Vit Ap University, Andhra Pradesh: Lab Sheet 11: Perspective View

The document provides code examples to illustrate one-point and two-point perspective views in OpenGL. For one-point perspective, it shows code to render a cube and cylinder. For two-point perspective, it also shows code to render a cube and cylinder with adjusted perspective and translation values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

VIT AP UNIVERSITY, ANDHRA PRADESH

Lab Sheet 11 : Perspective View


Academic year: 2020-2021 Branch/ Class: B.Tech
Semester: Fall
Faculty Name: Prof.Mangalraj School: SCOPE
Student name: Sriharshitha Deepala
Reg. no.: 19BCD7246

1. Write a programme in openGL to illustrate one point, and two point


perspective.
(A) One point Perspective:
CODE:
(a) Cube
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.3);
translate(0, 0, -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('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:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy