Polygon Tables VERTEX TABLE EDGE TABLE SURFACE-FACET TABLE v;:x1y1,z1 S;:E1,E2E3 V2:x2y2,z2 S2: E, Ea, Es. E6 V3: x3y3 z3 E,: V VI V4: xa,ya,zs V, V Vs: xs.ys,is Eg: VsV, Geometric data-table representation for two adjacent polygon surface facets, formed with six edges and five vertices Camputer Graphics with Open GL, Third Edition, by Donald Hearn and M. Pauline Baker ISBN0-13-0-15390-7o 2004 Pearson Education, Inc, Upper Saddle River, NJ. All rights reserve
Polygon Tables Geometric data-table representation for twoadjacent polygon surface facets, formed with six edges and five vertices 16
Chapter 4 Graphics Output Primitives(Part D) OpenGL Polygon Fill-Area Functions
Chapter 4 Graphics Output Primitives (Part II) OpenGL Polygon Fill-Area Functions 17
OpenGL Polygon Fill-area Functions o In Open GL, a fill area must be specified as a convex polygon o A vertex list for a fill polygon must contain at least three vertices e No crossing edges Valid Invalid e All interior angles for the polygon must be less than 180 Convex &o all interior angles are less than or d to 18 C A convex polygon(a)and a concave Otherwise Camputer Graphics with Open GL, Third Edition, by Donald Hearn and M. Pauline Baker ISBN0-13-0-15390-7o 2004 Pearson Education, Inc, Upper Saddle River, NJ. All rights reserve
OpenGL Polygon Fill-areaFunctions In OpenGL, a fill area must be specified as aconvex polygon A vertex list for a fill polygon must contain at leastthree vertices; No crossing edges; A convex polygon (a) and a concave polygon (b). ❖ Otherwise. (From: OpenGLProgramming Guide) All interior angles for the polygon must be less than180°. Convex: ❖ all interior angles are less than or equal to 180°. Concave: 18
OpenGL Polygon Fill-area Functions The figure on the left has a hole in it How do you show such polygon e One vertex list for only one polygon- filled area e You can define it by two a polygon with a complex overlapp convex terior. which cannot be specified with a single vertex list. polygons
A polygon with a complex interior, which cannot be specified with a single vertex list. OpenGL Polygon Fill-areaFunctions The figure on the left has a hole in it. How do you show such polygon? One vertex list for only one polygon-filled area You can define it by two overlapping convex polygons. 19
OpenGL Polygon Fill-area Functions In OpengL, specifying fill polygons are similar to those or describing a point or polyline glBegin(SYMBOLIC_CONSTANT) //set red color glVertex*(…); I Color3f(1.0,0.0,0.0); //specify 2D square glVertex*(…,); glBegin(GL_QUADS) glVertex2i (-2, 2) glVertex2i(2, 2); gl Vertex2i(-2, -2) o by default, a polygon interior is displayed in a solid color, determined by the current color settings 20
OpenGL Polygon Fill-areaFunctions In OpenGL, specifying fill polygons are similar tothose for describing a point or polyline. glBegin(SYMBOLIC_CONSTANT) glVertex*(…); glVertex*(…); … glEnd(); By default, a polygon interior is displayed in asolid color, determined by the current color settings //set red color glColor3f(1.0, 0.0,0.0); //specify 2D square glBegin(GL_QUADS); glVertex2i(-2,2); glVertex2i(2,2); glVertex2i(2,-2); glVertex2i(-2, -2); glEnd(); 20