[SOLVED] CSE4020 Lab 6

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon LabAssignment6-myvbdl.zip (185.4 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

 

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

A.

  1. Set the window title to your student ID and the window size to (480,480).
  2. Code skeleton

def myLookAt(eye, at, up): # eye, at, up are 1D numpy array of length 3

def myFrustum(left, right, bottom, top, near, far):

def render():

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

glEnable(GL_DEPTH_TEST)

glPolygonMode( GL_FRONT_AND_BACK, GL_LINE )

glLoadIdentity()

myFrustum(-1,1, -1,1, 1,10)

myLookAt(np.array([5,3,5]), np.array([1,1,-1]), np.array([0,1,0]))

# Above two lines must behave exactly same as the below two lines

drawFrame()

#glFrustum(-1,1, -1,1, 1,10)
#gluLookAt(5,3,5, 1,1,-1, 0,1,0)

glColor3ub(255, 255, 255)

drawCubeArray()

def myFrustum(left, right, bottom, top, near, far):

# implement here

def myLookAt(eye, at, up):

# implement here

D.

E.

F.

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

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

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)
  1. a 􏱃 b (inner product) : np.dot(a, b) or a@b
  2. 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().

1.51.51.5

6

15015 .
C. Start from the code in 6-Viewing & Projection2 & mesh slides. Make sure camera

􏰆􏰚􏰂􏰓􏰠􏰐􏰕􏰚􏰃􏰓􏰘􏰂 􏰈􏰗􏰘􏰌􏰃􏰛􏰐􏰃􏰈 􏰧􏰣􏰜􏰢 􏰧􏰼􏰜􏰢 􏰧􏰡􏰜􏰢 􏰧􏰪􏰜 􏰪􏰘􏰌􏰝􏰫 􏰲􏱇􏰘􏰂􏰜􏰃 􏰂􏰖􏰖􏰊 􏰃􏰘 􏰛􏰚􏰌􏰖 􏰚􏰍􏰘􏰐􏰃 􏰓􏰂􏰓􏰃􏰓􏰚􏰕 􏰅􏰓􏰖􏰪 􏰚􏰂􏰔􏰕􏰖􏱁

  1. Set the window title to your student ID and the window size to (480,480).
  2. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py)

0 1.5 1.5

001.5

01.jo 4

0

71.5.150

3

A.
B. Length of each line is 1.5

I

000

1.50

0.

  • LabAssignment6-myvbdl.zip