COSC4370 Interactive Computer Graphics (Spring 2024)

Homework 2: OpenGL

COSC4370 Interactive Computer Graphics (Spring 2024)

DUEMarch 5, 2023 AT 11:59 PM

1. Introduction

In this assignment, we will practice some of the basics of OpenGL.

2. Setup

a.  Access GitHub classroom (https://classroom.github.com/a/SZr95NeN) It has all the files needed. (important: use only this linkin this pdf, do not use any other linkin other places)

b.  Create empty project on repl.it. (https://replit.com/)

c.  Upload the starter files (main.cpp, freeglut-3.4.0.tar.gz, replit.nix) to the project and overwrite the default file with the provided one.

d.  Open “ .replit” file, replace the code from below image:

compile = ["bash", "-c", "g++ main.cpp -o main -lglut -lGL -lGLU"]

run = "./main"

entrypoint = "main.cpp"

requiredFiles = [".replit", "replit.nix"]

[nix]

channel = "stable-23_ 11"

e.  Extract freeglut on replit console using the following command:

tar -xzvf freeglut-3.4.0.tar.gz

The directory should look similar to this:

f.   Press “Run” button to run your code

It will generate a window with black screen and xyz coordinate. You can rotate it with mouse left-click and zoom with mouse right-click.

3. The Main Assignment

For this homework, you will be using your newfound OpenGL skills from class, as well as your artistic creativity, to create several 3D scenes with OpenGL. The first part of the assignment is to reproduce each of the following three images:

The second part of the assignment is to create, using similar techniques, a scene of your own imagination. All the code for this homework lives in main.cpp; you need to fill in the functions problem1, problem2, problem3, and problem4. You can switch between the different examples while the program is running by pressing the 1,2, . . . keys. Hence you don’t need to recompile in order to run different examples. Additionally, you can quit the program at anytime by pressing ‘q’, ‘Q’, or the Escape key.

4. Tips and Requirements

For each of the three reproductions, you should be able to create the image using only glutSolidTeapot, glutSolidCube, and OpenGL’s transformation mechanisms like glPushMatrix, glPopMatrix, glTranslatef, etc. Note that you should not need any custom geometry to reproduce the images.

Your reproductions do not need to match exactly. However, please try to make them match the examples as closely as possible. We used nice numbers in the reference solutions, so if you find yourself using strange fractions etc. to reproduce the examples, you maybe trying too hard!

For the open-ended image/scene, we require the following to make sure your image is interesting:

•   Make use of OpenGL’s transformation mechanisms in a nontrivial way, with at least one instance of nested applications of glPushMatrix (i.e., a glPushMatrix   within another glPushMatrix).

•   Render at least one triangle by feeding in its coordinates directly (OpenGL immediate mode is okay here, eventhough it’s deprecated). As an example, you could attempt to create a very rough approximation of an articulated hand

5. Deliverables

Submit all deliverables to your Github repository.

a.  Code (main.cpp) for generating each of your four images (30%)

b.  Screenshots (preferably .png) for each of your four images (20%)

c.  You need to write a detailed report in pdf  format. You should state the assignment problem, explain the algorithm or method you use, explain details of implementation, discuss your results, etc. (50%)

d.  Please include Replit link in both README file and pdf report.

6. Late submission and plagiarism check

A punishment deduction of 50% credit will be applied if your submission is later than the due date for less than 2 days. Later than that will be treated as give up, and the grade will be 0.

All your submissions will be subject to plagiarism check; if found, your behavior will be reported directly to the department. Any referred materials should be labeled in your source code and declared in your report.

发表评论

电子邮件地址不会被公开。 必填项已用*标注