[SOLVED] Computer Graphics-Lab Assignment 6

30.00 $

Programming resource
Digital learning resource
Category:
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

1. Write your own myLookAt() and myFrustum() functions (of the following form) that behaves exactly same as gluLookAt() and glFrustum().

def myLookAt(eye, at, up): # eye, at, up are 1D numpy array of length 3 def myFrustum(left, right, bottom, top, near, far):

A.

B.     Set the window title to your student ID and the window size to (480,480).

C.     Code skeleton

D.     Find code for drawFrame(), drawCubeArray() from 6-Viewing & Projection2 & mesh slides.

E.      DO NOT use gluLookAt() inside myLookAt() and glFrustum() inside myFrustum()!

F.      Your program should render the following scene:

i.

G.     Hint:

1.      To implement myLookAt(), see lecture slide 5-reference-viewing. To implement myFrustum(), see lab slide 6-Viewing & Projection2, mesh .

2.      l2 norm of v : ||v|| = np.sqrt( np.dot(v, v) )

3.      a x b (cross product) : np.cross(a, b)

4.      a ∙ b (inner product) : np.dot(a, b) or a@b

5.      Use glMultMatrixf() to multiply your projection matrix and viewing matrix to the current transformation matrix.

H.     Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py)

2. Write down a Python program to draw following cube (정육면체) by using indexed squares representation and glDrawElements().

A.

B.            Length of each line is 1.5

C.            Start from the code in 6-Viewing & Projection2 & mesh slides. Make sure camera manipulation shortcuts ‘1’, ‘3’, ‘2’, ‘w’ work. (Don’t need to care about initial view angle) D. Set the window title to your student ID and the window size to (480,480).

E. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py)

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.