DEPARTMENT OF COMPUTING

CS 3005: Programming in C++

Graphic Interface Parts 1 and 2

Introduction

In this assignment, you will start to introduce a graphical interface to the semester’s project, using GLUT and Open GL. The next assignment will complete the process.

This is a double assignment. It’s a lot of work. All documented here in one place.

Assignment

In this assignment, you will create a new application that uses the GLUT and Open GL to build a graphical user interface (GUI) for much of the functionality of the semester’s project. To start, you’ll download the starter code for the glut_main program from the course website, putting the code in the new diretory, gui-src, as a sibling of the src directory.

The starter code should build using its existing Makefile, and linking to the code in src.

You will extend this code to add additional functionality.

Programming Requirements

Create/Update glut_main.cpp

This file can remain unchanged from the starter code. Maybe you’ll want to change the window size or the title.

Create/Update gl_draw.cpp

This file can remain unchanged from the starter code.

Create/Update glut_app.{h,cpp}

These files can remain unchanged from the starter code.

Create/Update glut_callback.cpp

Reconfigure keyboard_cb, special_cb, and mouse_cb to call the GlutApp class’s member functions that do the actual work.

Create/Update AppData.{h,cpp}

These files should exist in the starter code. The AppData class provides all of the non-GUI data and functionality of the application.

Public Enumerations:

Data Members:

Methods:

Several of these methods will run commands after configuring the input stream to hold the required information for the command to run correctly. The data needed to configure the input stream, will usually come from parameters passed into the method. These methods should first use clearStreams() to clear the input and output streams, and then configure the input stream to hold the information needed to run the command, then call runCommand() to run the command.

Create/Update GlutApp.{h,cpp}

These files should exist in the starter code. The GlutApp class provides all of the GUI functionality of the application, using the AppData class to store information, and compute the output image.

Data Members:

Methods:

Expected Functionality

At the end of this assignment, your glut_main program should have this functionality:

Key/Action Method(s) called Notes
Initial image
start Displays a Julia set different from others in methods.
Pre-built configurations
‘J’ createJulia1()
‘j’ createJulia2()
’M’ createMandelbrot1()
’m’ createMandelbrot2()
‘C’ createComplexFractal1()
‘c’ createComplexFractal2()
Interaction modes
’T’ setInteractionMode() Color table interaction mode
’t’ setInteractionMode() Fractal interaction mode
Fractal Modes
‘b’ setFractalMode(), createFractal() Mandelbrot mode
‘n’ setFractalMode(), createFractal() Julia mode
‘F’ setFractalMode(), createFractal() Complex fractal mode
Color table operations
’>’ or ‘.’ increaseColorTableSize() The user can use either ‘>’ or ‘.’, your code must support both.
‘<’ or ‘,’ decreaseColorTableSize() The user can use either ‘<’ or ‘,’, your code must support both.
‘r’ randomColor1() Color table display mode only. Otherwise, do not do this action.
‘R’ randomColor2() Color table display mode only. Otherwise, do not do this action.
Plane coordinate operations
‘z’ zoomIn(), createFractal() Zoom into the plane.
‘Z’ zoomOut(), createFractal() Zoom out of the plane.
left arrow moveLeft(), createFractal() Move the view port left in the plane.
right arrow moveRight(), createFractal() Move the view port right in the plane.
down arrow moveDown(), createFractal() Move the view port down in the plane.
up arrow moveUp(), createFractal() Move the view port up in the plane.
‘R’ resetPlane(), createFractal() Fractal display mode only. Otherwise, do not do this action.
left mouse button setAB(), setFractalMode(), createFractal() Fractal display mode and Mandelbrot fractal mode only. Otherwise, do not do this action. Set the A/B values, change the fractal mode to Julia, the create the fractal.
Fractal calculation configuration
’+’ or ‘=’ increaseMaxNumber(), createFractal() The user can use either ‘+’ or ‘=’, your code must support both.
’-’ or ‘_’ decreaseMaxNumber(), createFractal() The user can use either ‘-’ or ‘_‘, your code must support both.
Window configuration
resize setSize() is called. It should recreate the fractal currently configured in the data.

Update src/Makefile

No changes here: The following commands should work correctly.

Update gui-src/Makefile

Should be able to use the file as is.

Additional Documentation

Show Off Your Work

To receive credit for this assignment, you must

Additionally, the program must build, run and give correct output.

Last Updated 04/09/2024