COSC 355 Computer Graphics
Assignment 3
Due Wednesday, October 3, 2001
Write a C++ program that uses OpenGL to create a 2D polyline drawing based on a list of vertices stored in a data file. The format of the data file is similar to VRML’s format for IndexedLineSet and IndexedFaceSet. The file has two sections. The first section lists the coordinates of all vertices, separated by commas and optional white space, possibly on multiple lines. For simplicity, you may assume that line breaks occur only between vertices, not between the coordinates of a vertex. This section is followed by the word BEGINLINES on its own line with no leading white space. The second section lists the indices of coordinates, separated by commas and optional white space, possibly on multiple lines. Each polyline is terminated by an index of -1. For simplicity, you may assume that line breaks occur only between polylines, not between the indices of a polyline. Your program needs to determine an appropriate world window from the data set. You may assume that there are no errors in the data file. Here is a sample data file that draws a wheel with spokes.
0 0, 1 0, .5 .866, -.5 .866,
-1 0, -.5 -.866,
.5 -.866
BEGINLINES
4, 1, -1, 2, 5, -1,
3, 6, -1,
1, 2, 3, 4, 5, 6, 1, -1
This data file is available on the class Web site. Combine your source program(s) and Win32 executable into a zip file named 03lastname.zip, and submit it to the A01\handin directory on the project drive.