CS472 uses Qt, which is a C++ graphical user interface library for creating nice interfaces to support your application. We use Qt to allow you to easily interact with your graphics programs. You will be able to use widgets such as sliders, spinboxes, radio buttons, pushbuttons, and more to specify parameters for your homework assignments. CS472 also uses the OpenGL graphics library to render the output.
Each homework assignment will require you to implement a class (e.g., HW1, HW2, ...). A sample HW0 class is implemented for you to see several fully working implementations. The source code is in the CS472.skel/hw0 subdirectory. The skeleton code for the first homework assignment can be found in the CS472.skel/hw1 subdirectory. All of the Qt code necessary to collect parameters for all homeworks is entirely supplied to you so that you don't need to spend time on the graphical user interface. You only need to fill in the stubs in hw1/HW1*.cpp where it says "// PUT YOUR CODE HERE". Your homework assignment will be installed under menu HW1 in the menubar.
The viewports should be ordered from left to right, bottom to top. Use the glViewport(x, y, w, h) function, where (w,h) is the viewport width and height, and (x,y) is the position of the bottom left corner of the viewport. Note that (0,0) is the bottom left corner of the canvas. Set the background and foreground colors to black and white, respectively, for all drawings. Do not use shader code for this assignment. Just use the supplied vector of 32 floats that holds the (x,y) coordinates of the 16 vertices and make calls to glVertex2f() to draw the data in each viewport using each of the nine drawing modes (e.g., GL_POINTS, GL_LINES, ...).
Make sure to write (or refer to) the following functions to complete this assignment:
triangle(a, b, c) should rotate/twist vertices a, b, and c.
The three transformed vertices get pushed onto a vector called m_points.
Each of these vertices gets the same random color assigned to it.
Those values are pushed onto a vector called m_colors.
divideTriangle(a, b, c, count) should recurse count times.
At each level of recursion, the function splits one triangle into four triangles until
the base case is reached (count reaches 0).
Then, triangle(a, b, c) is called to save away the triangle data into m_points and m_colors.
The graphical user interface code invokes changeTheta(n), changeSubdiv(n), and changeTwist(flag) as functions that respond to changes in the sliders or radio buttons. Please note that the n parameter is the slider value. These functions will clear the m_points (and possibly m_colors) vector so that new values can be pushed into them when processing the geometry under new GUI settings.