WPI Computer Science Department

Computer Science Department
------------------------------------------

CS 543, Fall Semester 2019 Homework 1, Due Wednesday, September 18, 2019, by class time


Homework 1 Overview

This project requires you to write a 2D program with fractals, keyboard controls and interaction.

Homework 1 Specifics

Step 1: Download and Compile the starter shader application : Download and unzip the following zip file [ Here ] . Visual Studio 10 is already installed on the Zoolab machines. Double-click on the Visual Studio file to open it Press Ctrl-F5 to compile and run the program. Its the same starter code provided for Homework 0 and should draw a triangle to the screen. If the triangle is drawn, you are all set! This program should run without problems on the Zoolab machines. VERY IMPORTANT NOTE: All your work must be done with this Visual Studio solution. DO ALL YOUR WORK BY EXTENDING THE STARTER VISUAL STUDIO SOLUTION AND ASSOCIATED C++ FILES. DO NOT CREATE A NEW VISUAL STUDIO SOLUTION. SIMPLY MODIFY THE C++ FILES AND HEADERS SO THAT WHEN YOU ARE DONE, YOU WILL SIMPLY ZIP UP YOUR ENTIRE FOLDER AND SUBMIT THE ZIPPED SOLUTION.

The starter Visual Studio solution should also work on your home machine or any machine with adequate hardware. But again, I will help you on the Zoolab machines. WPI CCC machines. It's your responsibility to get things working on your home machine.

Step 2. Render the sierpinski Gasket: Modify the starter program given to you to draw the Sierpinski Gasket as explained in class. The code for the Sierpinski gasket is actually in your text.

Step 3. Modify the program so that it can read in and draw the following polyline files: The polyline files below are in the GRS format, a homegrown format:

bronto.dat
usa.dat
knight.dat

The structure of GRS files is:

Step 4. Render the Hilbert Curve: Modify the starter program given to you to draw the Hilbert Curve as explained in class. Recursion is your friend for this part of your assignment. See the Hilbert Curve page at Mathworld for more information. Also see the wikipedia, it has a better explanation. This tutorial also has some useful information and may give you some ideas about how to apply different shapes and colors.

Remember that what you are really doing, is replacing the "cup", the three-line segment, with four cups that are connected together with short lines. The new cups are one rotated counter clockwise, two in the same direction, then one rotated clockwise, all with lines connecting the end of one cup with the beginning of the next. Connectors are never changed, except that they will get smaller in length. It is the cups that get replaced with four new cups.

By default you should draw the Hilbert Curve iterated 3 times.

Summary of Your program behavior

After the practice, now re-organize your program to have the following behavior. When program starts as default, the Hilbert Curve (3 iterations) is drawn. Your program should then respond to the following key strokes Notes: No OpenGL fixed function commands (glBegin, glVertex, etc) or immediate mode drawing commands should be used in your program. All drawing should be done using shaders, retained mode, Vertex Buffer Objects, and glDrawArrays similar to the code in your textbook (and in the starter code)

Color Pattern: Your Hilbert Curve should have the color pattern below which is explained in detail in this [ tutorial ]

Iteration 1 diagram

Aspect ratio: You should maintain aspect ratio in all your drawings. This should be done initially whenever you draw a polyline or Hilbert Curve for the first time. Also, implement a reshape function that recalculates the correct dimensions of the drawing whenever the user changes the current drawing Window dimensions.

Keyboard control: In order for your program to respond to keyboard strokes, you will need to write and register a keyboard callback function.

Submitting Your Work

Make sure to double-check that everything works before submitting. Submit all your executable and source files. Put all your work files (Visual Studio solution, OpenGL program, shaders, executable and input files into a folder and zip it. Essentially, after your project is complete, just zip the project directory created by Visual Studio. Submit your zip file using InstructAssist at [ https://ia.wpi.edu/cs543/] . Do not email me your program or submit it via dropbox. To make your submission smaller, delete the \ipch folder in the visual studio. On recompilation, Visual Studio will regenerate this folder without problems.

Create documentation for your program and submit it along with the project inside the zip file. Your documentation can be either a pure ASCII text or Microsoft Word file. The documentation does not have to be long. Briefly describe the structure of your program, what each file turned in contains. Explain briefly what each module does and tie in your filenames. Most importantly, give clear instructions on how to compile and run your program. MAKE SURE IT RUNS IN THE ZOOLAB before submission. Name your zip file according to the convention FirstName_lastName_hw1.zip

General Hints

Here are a more few hints you might find useful:


[Feedback] [Search Our Web] [Help & Index]

[Return to the WPI Homepage] [Return to CS Homepage]

mailto:emmanuel@cs.wpi.edu