Homework 1 OverviewThis project requires you to write a 2D program with fractals, keyboard controls and interaction.
Homework 1 Practice Steps
Step 1: Download and Compile the starter shader application : Download and run the starter code given to you in Project 0, part 3 [ Here ] . Visual Studio 2017 is already installed on the Zoolab machines. Double-click on the Visual Studio file to open it Compile and run the program. It should draw a triangle to the screen.
VERY IMPORTANT NOTE: 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 the TA and 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:
The structure of GRS files is:
Step 4. Render the Koch snowflake: Modify the starter program given to you to draw the Koch snowflake as explained in class. Recursion is your friend for this part of your assignment. See the Koch snowflake handout I gave out in class. When your program first renders the Koch snowflake, it should be iterated to level 3 (S3). But it should be possible to iterate the Koch snowflake to higher or lower levels (see below).
- a number of comment lines, followed by a line starting with at least one asterisk: '*'.
- The "extent" of the figure: (left, top, right, bottom).
- The number of polylines in the figure.
- The list of polylines: each starts with the number of points in the polyline, followed by the (x, y) pairs for each point.
Summary of Required program behaviorAfter the practice, now re-organize your program to have the following behavior. When program starts as default, the Koch snowflake (3 iterations, S3) 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)
- key S: Clear screen and draw Sierpinski Gasket
- Key K: Clear screen and draw the Koch snowflake (default is to iterate 3 times). Track the iteration level. You will change it below
- key I: Clear screen, increase the number of iterations +1 (i.e. if current iteration level is 3, increase it to 4) and draw the Koch snowflake
- key R: Clear screen, reduce the number of iterations -1 (i.e. if current iteration level is 3, decrease it to 2) and draw the Koch snowflake
- Key U: Clear screen and draw a 4x4 tiling of USA polyline
- key D: Clear screen and draw a 4x4 tiling of the dragon polyline
- key V: Clear screen and draw a 4x4 tiling of the Vinci polyline
Koch snowflake Examples: Examples of iterations of the Koch snowflake are shown below:
Aspect ratio: You should maintain aspect ratio in all your drawings. This should be done initially whenever you draw a polyline or Koch snowflake 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 WorkMake 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
Here are a more few hints you might find useful:
- You need to modify your keyboard( ) function in order to react to keyboard input from the user and your mouse( ) function to react to mouse input.
- Section 2.11 of your text explains simple mouse and keyboard interaction using openGL/GLUT.