Presentation is loading. Please wait.

Presentation is loading. Please wait.

Objects aka Polygonal Mesh (6.2)

Similar presentations


Presentation on theme: "Objects aka Polygonal Mesh (6.2)"— Presentation transcript:

1 Objects aka Polygonal Mesh (6.2)
Objects are hollow and made of faces that share common edges Faces are considered to be outward facing Data Structure vertex list (geometry) face list (topology) normal list (orientation) normal list ignored by uisGL Sample Data ~grissom/367/DATA several files “*.3vn” Sample code uisObject Obj; // define ifstream datafile; datafile.open(“file.3vn”, ios::in); datafile >> Obj; // reads data from file datafile.close(); numV = Obj.getNumVertices(); numF = Obj.getNumFaces(); F1 = Obj.getFace(16); // return face # 17 P1 = Obj.getVertex(3); // return vertex # 4

2 Rendering Faces Faces are made of an ordered sequence of points (counter clockwise is the convention) Assumed to be planar and convex Triangles are often used Face uisVertex P; uisFace F1, F2; // define P = F1.getVertex(2); // get third vertex of face size = F1.getNumVertices(); See documentation for additional operations Group Activity write pseudo code to render a face

3 Rendering Objects Pseudo code For each Face Draw Face OpenGL code
uisObject Obj; // define in_file >> Obj; // reads data from file for i=0 to Obj.getNumFaces() Face = Obj.getFace(i); glBegin(GL_LINE_LOOP); for j = 0 to Face.getNumVertices() P1 = Face.getVertex(j); glVertex3fv(P1); glEnd( ); Group Activity Write pseudo code to render an object


Download ppt "Objects aka Polygonal Mesh (6.2)"

Similar presentations


Ads by Google