This assignment is intended to be a gentle introduction to graphics programming. The goal is to write a very simple application that uses the basic features of the OpenGL, and some simple interaction with what is drawn on the screen.
The application will draw a single square in the center of a window, and should allow a user to resize, move and rotate this square. The color of the square should optionally change based on the keyboard input.
Basic Features (75 points):
- Installing all libraries.
- Drawing a square that moves when the user clicks a drags their mouse.
Required Features (20 points):
- (5) Translating only when the user drags on the square’s interior (not the
edge or outside the square)
- (5) Scaling the square when the user drags on the edges
- (10) Rotating the square when the user drags on the corners
(5) Changing something visually when the user presses the keyboard (10) Texturing the square
(10) Supporting both a square and triangle
(5) Graphical indicator of what motion is being performed. (5) Animating the square on it’s own
(5) Multiple squares
(5) Maintaining the square’s shape when the window aspect ratio changes
Submission should be in the form of a link to a webpage. The web page must contain
an image of your program in progress. A short description (~1 paragraph) of any difficulties you encountered. A zip file with all the code needed to compile your project and a working executable.
Optionally, you may submit an image of an artistically interesting image resulting from your work. Sufficiently “interesting” pictures will be awarded 5 points, the best in the class 10 additional points.
You will need the starter code, which is available from the course webpage.
You will also need to download SDL: https://www.libsdl.org/download-2.0.php has Window and Mac binaries.
On Ubutun you need to install libsdl2-dev
e.g., sudo apt-get install libsdl2-dev
OpenGL should come installed already in your system (see http://www.opengl.org/wiki/Getting_Started). However, please make sure you have update drivers, and a fairly recent computer.
Mac users will have to download Xcode to get GCC etc.
If you are compiling on Windows using MSVS the compiler flags should already be set for you. On OSX or Linux, be sure to specify that you need to link against GLEW, GLUT and opengl.
g++ Square.cpp glad/glad.c -framework SDL2 -framework OpenGL -o square
g++ Square.cpp glad/glad.c -lSDL2 -lSDL2main -lGL -o square
Be sure to include both SDL2 and SDL2main when linking.
Rotation is much more difficult than the rest. Get everything else working first, ignoring rotation! Rotation will complicate how you draw the square and how you detect which operation to perform.