Computer Graphics-Lab Assignment 6 Solved

35.00 $

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

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (1 vote)

Computer Graphics, Lab Assignment 6

 

+ LabAssignment2/

+ 1/

  • py

+ 2/

  • py

+ 3/

  • py

 

  • The submission time is determined not when the commit is made but when the git push is made.

 

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

def myLookAt(eye, at, up): # eye, at, up are 1D numpy array of length 3 def myOrtho(left, right, bottom, top, zNear, zFar):

  1. Set the window title to your student ID and the window size to (480,480).
  2. Code skeleton
  3. Find code for drawFrame(), drawCubeArray() from 6-Viewing,Projection
  4. DO NOT use gluLookAt() inside myLookAt() and glOrtho() inside myOrtho()!
  5. Your program should render the following scene:
  6. Hint:
    1. Everything you need to write code is in 6-Viewing,Projection
    2. l2 norm of v : ||v|| = np.sqrt( np.dot(v, v) )
    3. a x b (cross product) : np.cross(a, b)
    4. ab (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.
  7. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py)

 

  1. As mentioned in the lecture, “moving camera” and “moving world” are two equivalent operations. Based on the following figure, replace the gluLookAt call() in the following code with two glRotatef() calls and one glTranslatef() call and complete the program.
def render():  
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glEnable(GL_DEPTH_TEST)  
    glPolygonMode( GL_FRONT_AND_BACK, GL_LINE )  
    glLoadIdentity()  

 

gluPerspective(45, 1, 1,10)

 

# Replace this call with two glRotatef() calls and one glTranslatef() call

    gluLookAt(3,3,3, 0,0,0, 0,1,0)

 

drawFrame()

 

    glColor3ub(255, 255, 255)
    drawCubeArray()  
  1. Set the window title to your student ID and the window size to (480,480).
  2. Find code for drawFrame(), drawCubeArray() from 5-RenderingPipeline slides.
  3. Your program should render the following scene:
  4. Files to submit: A Python source file (Name the file whatever you want (in English). Extension should be .py)

 

  • LabAssignment6-9jr5ud.zip