teaching machines

CS 491 Lecture 21 – OpenGL

Before class

A

Before we meet:

B

Before we meet:

In class

With your partner, build off the base renderer we constructed in class to load in a torus, light it, and shade it. Given the complexity and newness of OpenGL to most of you, I’ve sprinkled TODOs in places where changes need to be made. I suggest you follow these steps:

  1. Create and start an AVD with GPU emulation on.
  2. Import the base project, which is very similar to what we wrote in class. It’s zipped up as labgl.zip in the class directory on the W drive.
  3. The geometry file is in res/raw/torus2.w3d. Look at the file. The vertices start with v. The faces with f. New is a section for normals right after the vertices, each starting with vn. There is a normal defined for each vertex. Read these into a FloatBuffer. The project won’t run until you do this. After reading these in, test.
  4. Add a projection and look matrix as discussed. Transform the vertices in the vertex shader. Test.
  5. Add shading using the vertices’ normals. Uploading them will be quite similar to uploading the position attribute. Test.
  6. Support rotation. Test.

Comments

  1. Octavian says:

    I like the idea of 2 separate teams interacting each other, unfortunately I’m from a different country and I cannot participate in your class. I was wondering if you could provide the source code for generating the sphere in your lessons, if it’s not imposing

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *