Assignment 3 - Intro. to OpenGL and the Arcball

Due Wednesday Oct. 30, 2019 at 3:00 PM

Overview

In this assignment, you will recreate the 3D shaded surface renderer from Assignment 2 as an OpenGL C++ program that lets you interact with rendered scenes using the mouse. The assignment is meant to act as an introduction to writing graphics programs using OpenGL and to the commonly used Arcball mechanism for rotating scenes with the mouse. Quaternions are also covered in this assignment as a way to represent rotations for the Arcball.

Before you begin, you may want to review the assignment material with these lecture notes. The files for this assignment can be downloaded here. More in-depth details for the assignment will be given in the sections below.


Your Assignment

Your task is to write a program in C++ that takes as input a file with the same scene format from Assignment 2 and renders the specified scene in an OpenGL display window (with desired x and y resolutions). The program should also allow the user to intuitively rotate the scene with an Arcball mouse UI.

The input of your program should be read from standard input as so:

./opengl_renderer [scene_description_file.txt] [xres] [yres]

xres and yres are integers that specify the x and y resolutions of the OpenGL display window. Unlike in Assignment 2, there is no “mode” argument in this assignment because OpenGL can only render using Gouraud shading. In order to render using Phong shading, we need to use the OpenGL Shading Language (or GLSL for short), which we defer to a later assignment. For now, we are just working with basic OpenGL.

Within the hw3 folder is an OpenGL demo program that is meant to serve as a template for your own OpenGL program. We recommend making use of the demo’s source code and comments and its Makefile as references for when you are writing your own program.

There are two main parts to this assignment:

1.
(70 Points) Parse the scene description file and put the data into appropriate C++ data structures. Then, follow the template code and comments from the OpenGL demo to recreate the shaded surface renderer within an OpenGL context. Use the exact same test files from Assignment 2 to see whether your OpenGL program is displaying the scenes properly. The scenes that OpenGL renders on its display screen should match the Gouraud-shaded scenes from Assignment 2.

2.
(30 Points) Add an Arcball implementation based on the quaternion method to your OpenGL program so that the user can intuitively rotate the scene about the origin with the mouse. Refer to the lecture notes for details on the Arcball. You should implement your own Quaternion class with the operations described in the lecture notes (don’t use an external quaternion library, e.g. Eigen). You may want to first implement the Arcball using the usual axis-angle rotation matrices, just to get a sense of the idea. In the end, you should be able to manipulate the displayed scenes with the mouse in a manner similar to what is shown in the movie at the top of the screen (though take care to remember that scenes with translated cameras in x and y will not rotate about the screen center).

Please do your work for this assignment in the hw3 folder of hw3.zip.


What to Submit

Before submitting, please comment your code clearly and appropriately, making sure to give details regarding any non-trivial parts of your program.

Submit a .zip or .tar.gz file containing all the files that we would need to compile, run, and test your program. In addition, please submit in the .zip or .tar.gz a README with instructions on how to compile and execute your program as well as any comments and information that you would like us to know.

We ask that you name your .zip or .tar.gz file lastname_firstname_hw3.zip or lastname_firstname_hw3.tar.gz respectively, where you replace the “firstname” and “lastname” fields with your actual first and last name.

Please submit your zip or tar.gz to moodle in the area for Assignment 3.


Written by Kevin (Kevli) Li (Class of 2016).
Links: Home Assignments Contacts Policies Resources