Anda di halaman 1dari 10

Department of Computer Science Lab 10: 3D Viewing

University of Karachi BSCS 514 –Computer Graphics


Course Incharge: Humera Tariq

Objective: To be able to Understand 3D Viewing in a 3D Scene

House
Moon

Blue
Mountains

Christmas/triangular
tree Circular Tree
Ground

Task 1: Fill in the table and write what primitive/ strategy you use to model above objects of
your scene

1|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Your Object Primitive/Strategy used

1. Ground

2. House

3. Mountain

4. Circular Tree

5. Christmas Tree

6. Moon

Task 2: Draw 3D world space, Mark Origin Point and four corners of the ground
using code given below:

Origin ? x-axis ? , y axis ?, z axis? Minimum(x,y,z) of floor ? Maximum (x,y,z) of floor ?

2|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Task 3: Write the difference between orthographic and perspective view. Then Draw
Orthographic and perspective Front view of given Scene in space provided below:

3|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Orthogrphic Front view (Assume you are looking infront of door)

Perspective Front view (Assume you are looking infront of door)

Task 4: Draw Orthographic and perspective Side view of given Scene in space provided below:

Orthogrphic Side view

4|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Perspective Side view

Task 4: Mark the Locations (x,y,z) of Objects on the top view given below using code:

5|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Code for Task 4

6|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

} // end drawEverything

Task 5: Mark all the vertices of House using code in Task 4

7|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Task 6: Assume you stand in front of House door looking straight through door.

8|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Write your suggestions for glOrtho(?,?,?,?,?,?) and gluLookAt(……?.......);

Draw your establisthed View volume in world space to show how much of your scene is
covered by view volume.

Task 7: Start with Skeleton Code and Finalize display routine to create First view of your 3D scene

Perspective Camera if ortho =0 Orthogrphics Camere if ortho =1


void display() Set Multiple viewports and show all
{ views
glClear(GL_COLOR_BUFFER_BIT | if (ortho==1) //
GL_DEPTH_BUFFER_BIT); {

if (ortho==0) //Perspective view }


{
//Place the camera and set target
glutSwapBuffers(); //Double Buffer
//Define Viewing Volume }

//Draw Objects
drawEverything();
drawFloor();}
Target view

9|Page
Lab 10: 3D Viewing
BSCS 514 –Computer Graphics
Course Incharge: Humera Tariq

Task 8: Add Mouse and Keyboard interaction to view your scene

10 | P a g e

Anda mungkin juga menyukai