In this lab you will develop an interactive OpenGL viewer for 3D models using
FLTK's Fl_Gl_Window. After completing this lab, you may use this as a base for
subsequent labs.
Basic requirements
- Create a basic 3D viewer application that displays multiple objects. Use
orthographic (parallel) projection and smooth-shading by default.
You may use CubeView as a starting point.
- Allow the user to toggle between wireframe, flat-shading, and
smooth-shading.
- Allow the window to be resized, but preserve the aspect ratio of the image.
- Allow the user to translate, rotate, and (uniformly) scale the model using
the mouse in the Fl_Gl_Window. See
the FLTK OpenGL docs
and the handle() method in Fl_Gl_Window.
The user should be able to place and orient the model in any way desired.
Also, allow the user to reset the model to its original state.
- Display the current rendering speed of your program in polygons per
second.
- Use a model with a reasonably large number of polygons, for better
precision in measuring rendering speed. The model data may be programmatically
generated, hard-coded in your program, or read in from a file.
You can be creative with your model!
- Feel free to add on fancier options, user-interface, etc.!
Questions for your write-up
- How many polygons per second can your render unfilled and filled?
- What is the effect on performance of using quadstrips or triangle strips
versus quads or triangles?
- What is the effect on performance of putting multiple primitives between a
glBegin/glEnd versus using a separate glBegin/glEnd for each one?
Lab write-up
- Somewhere in your write-up, answer each of the questions in the preceding
section.
- Follow the template lab write-up
to document your program. Name your write-up:
your_name_lab3_writeup.doc (or .txt, etc.)
Put it in the same project directory as your code so that it will be
included in the tarball.
Electronic turn-in
- Put everything (C++ code, header files, executable, lab
write-up) into a tarball/ZIP and upload it to eCourses under "Lab3":
your_name_lab3.tar.gz
- For this lab only, the late penalty will be reduced to one point per
calendar day, up to two weeks. Lab3 cannot be submitted more than two weeks late.