Other Geometric Primitives - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Other Geometric Primitives

Description:

Surface tesselation is a curved surface approximated with ... Degenerate polygon describes a set of vertices that are collinear. Polygons may not be planar. ... – PowerPoint PPT presentation

Number of Views:34
Avg rating:3.0/5.0
Slides: 14
Provided by: isabellebi
Category:

less

Transcript and Presenter's Notes

Title: Other Geometric Primitives


1
Other Geometric Primitives
2
Agenda
  • Polygon Fill Area Functions
  • Raster Functions
  • Display Lists

3
Learning Objectives
  • Understand OpenGL functions related to polygon
    fill areas, raster manipulation, and display
    lists.

4
Fill-Area Primitives
  • Fill-area
  • Area filled with a certain color
  • Most often the shape is that of a polygon
  • Boundaries are linear
  • Surface tesselation is a curved surface
    approximated with polygon facets (surface fitting
    with polygon mesh)
  • Standard graphic objects are objects made of a
    set of polygon surface patches.

5
Polygons
  • Polygon classification
  • Polygon is a planar shape having a
    closed-polyline boundary and no edge crossing
  • Convex polygon has all interior angles less than
    or equal to 180ยบ, line joining two interior
    points is also interior to the polygon
  • Concave polygon otherwise
  • Degenerate polygon describes a set of vertices
    that are collinear
  • Polygons may not be planar.

6
Polygon Fill-Areas
  • Polygon example (hexagon)
  • Polygon is a planar shape having a
    closed-polyline boundary and no edge crossing
  • gl.glBegin (GL.GL_POLYGON)
  • for (k 0 k lt 6 k)
  • theta TWO_PI k / 6.0
  • hexVertex.x circCtr.x 150 cos
    (theta)
  • hexVertex.y circCtr.y 150 sin
    (theta)
  • gl.glVertex2i (hexVertex.x, hexVertex.y)
  • gl.glEnd ( )

7
Polygon Fill-Areas
  • Other polygon examples
  • Triangle (GL_TRIANGLES or GL_TRIANGLE_STRIP or
    GL_TRIANGLE_FAN)
  • Rectangle (GL_RECT, where means d, f, i, s, v)
  • Quadrilateral (GL_QUADS or GL_QUAD_STRIP)

8
Raster Functions
  • Raster operations
  • Assigning a color to an array of pixels
    (pixmap)glDrawPixels (width, height, data
    format, data type, pixMap)
  • ExampleglDrawPixels (128, 128, GL_RGB,
    GL_UNSIGNED_BYTE, colorShape)where colorShape
    is an array of pixels of size 128 x 128

9
Raster Functions
  • Raster operations
  • Reading an array of pixels (pixmap)glReadPixels
    (xmin, ymin, width, height, dataFormat, dataType,
    array)
  • dataFormat (GL_RGB, GL_BLUE, )
  • dataType (GL_BYTE, GL_INT, GL_FLOAT, )
  • glCopyPixels (xmin, ymin, width, height,
    pixelValues)

10
Character Functions
  • Characters
  • Size
  • Type (font, or typeface) (Times, Courier, )
  • Serif (small lines or accents at the end of the
    character strokes), more readable
  • Sans serif (no accent), more legible (easy to
    recognize)
  • Monospace / proportional (width varies)
  • Bitmap font (represented by pixels), raster font
  • Postscript font (filling-in outline)

11
Character Functions
  • OpenGL character functions
  • glutBitmapCharacter (font, character)
  • Font (GLUT_BITMAP_TIMES_ROMAN_10, )
  • Character (A, , a, ) or ASCII code (65, ,
    97, )
  • glutStrokeCharacter (font, character)
  • Font (GLUT_STROKE_ROMAN, GLUT_STROKE_MONO_ROMAN)

12
Display Lists
  • A display list provides a name for a sequence of
    statements.
  • List creationglNewList(listID,
    listMode)glEndList()listID positive
    integerlistMode GL_COMPILE or
    GL_COMPILE_AND_EXECUTE

13
Display Lists
  • Automatic ID generationlistID glGenLists(1)
  • List executionglCallList(listID)
  • List deletionglDeleteLists(startID, nLists)
Write a Comment
User Comments (0)
About PowerShow.com