/************************************************************************* FILE: geometry.cc Functions creating the geometry of the objects in the scene and drawing them. Author: Dana Vrajitoru, IUSB Class: C481 B581 Computer Graphics **************************************************************************/ #include #include using namespace std; #include "glheader.h" #include "geometry.h" // Read .raw file as a triangle strip void loadRawFile(char *filename) { ifstream fin; float x, y, z; int i = 0; char txt[25]; fin.open(filename); glNewList(MESH_ID, GL_COMPILE); do { fin >> x >> y >> z; glColor3f(i%2, i/(9.0f), 0); glBegin(GL_TRIANGLES); i++; while(fin.good()) // stop when we find a text comment { glVertex3f(x, y, z); fin >> x >> y >> z; } glEnd(); // and start a new triangle strip fin.clear(); fin >> txt; // the comment } while(fin.good()); glEndList(); fin.close(); } // a version of drawing the window that uses the display list void draw1() { glCallList(MESH_ID); }