Lab 01: January 17, 2014
Overview
Today's lab is to introduce you to graphics programming using OpenGL. We are to complete the classic
"hello world" for graphics by having OpenGL render a coloured triangle.
I have provided code file (lab01.cpp) that initializes a GLUT window and sets up the necessary
callbacks to support the realtime updates necessary to support rendering.
Task
Your task is to provide the OpenGL code to render a triangle, a quadrilateral and if you feel adventurous a teapot.
Optional experiments:
-
Try rendering a teapot/torus/sphere using the glut calls: glutSolidTeapot( Size ), glutWireTeapot( Size )... API: described at
OpenGL.org
-
Try rendering the wireframe by switching the renderstate from glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ) to
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
You are free to modify (add to) the lab01.cpp or makefile as you wish.
Code Files
Lab1.cpp
makefile