Unformatted text preview:

CSCE 441: Computer Graphics Scan Conversion of PolygonsOpenGL Geometric PrimitivesSlide 3Slide 4Drawing General PolygonsDrawing Curved ObjectsOutlineDrawing RectanglesSlide 9Slide 10Slide 11Slide 12Slide 13Slide 14General Polygons – Basic IdeaSlide 16Slide 17Slide 18Slide 19Slide 20How to store polygon edges?General Polygons – Data StructuresGeneral Polygons – ExampleSlide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Scan line intersectionSlide 36Slide 37General Polygons – AlgorithmSlide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 50Slide 51Slide 52Slide 53Slide 54Slide 55Slide 56Slide 57Slide 58Slide 59Slide 60Slide 61Slide 62Slide 63Slide 64Slide 65Pixel Fill-inSlide 67General Polygons – ProblemsCurved BoundariesBoundary FillSlide 71Slide 72Slide 73Slide 74Boundary Fill – ExampleSlide 76Slide 77Slide 78Slide 79Slide 80Slide 81Slide 82How to deal with this?Slide 84Flood FillFlood Fill – ExampleSlide 87Slide 88Slide 89Slide 90Slide 91Slide 92Slide 93Slide 94Slide 95Slide 96Slide 97Slide 981CSCE 441: Computer GraphicsScan Conversion of PolygonsJinxiang Chai2/95OpenGL Geometric PrimitivesAll geometric primitives are specified by verticesGL_QUAD_STRIPGL_QUAD_STRIPGL_POLYGONGL_POLYGONGL_TRIANGLE_STRIPGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_TRIANGLE_FANGL_POINTSGL_POINTSGL_LINESGL_LINESGL_LINE_LOOPGL_LINE_LOOPGL_LINE_STRIPGL_LINE_STRIPGL_TRIANGLESGL_TRIANGLESGL_QUADSGL_QUADS3/95OpenGL Geometric PrimitivesAll geometric primitives are specified by verticesGL_QUAD_STRIPGL_QUAD_STRIPGL_POLYGONGL_POLYGONGL_TRIANGLE_STRIPGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_TRIANGLE_FANGL_POINTSGL_POINTSGL_LINESGL_LINESGL_LINE_LOOPGL_LINE_LOOPGL_LINE_STRIPGL_LINE_STRIPGL_TRIANGLESGL_TRIANGLESGL_QUADSGL_QUADS4/95OpenGL Geometric PrimitivesAll geometric primitives are specified by verticesGL_QUAD_STRIPGL_QUAD_STRIPGL_POLYGONGL_POLYGONGL_TRIANGLE_STRIPGL_TRIANGLE_STRIPGL_TRIANGLE_FANGL_TRIANGLE_FANGL_POINTSGL_POINTSGL_LINESGL_LINESGL_LINE_LOOPGL_LINE_LOOPGL_LINE_STRIPGL_LINE_STRIPGL_TRIANGLESGL_TRIANGLESGL_QUADSGL_QUADS5/95Drawing General PolygonsHow to draw every interior pixels??6/95Drawing Curved ObjectsHow to draw every interior pixels??7/95OutlineMethods for drawing polygons or curved objects - Scanline conversion of polygons - Boundary-fill - Flood-fillRequired readings: - HB 4-9 to 4-148/95Drawing RectanglesWhich pixels should be filled?9/95Drawing RectanglesIs this correct?10/95Drawing RectanglesWhat if two rectangles overlap?11/95Drawing RectanglesIs this correct?12/95Drawing RectanglesIs this correct?Overlap!!!13/95Drawing RectanglesSolution: Exclude pixels on top and right14/95Drawing RectanglesArtifacts are possible15/95General Polygons – Basic IdeaHow to draw every interior pixels?16/95General Polygons – Basic IdeaHow to draw every interior pixels for a scan line?17/95General Polygons – Basic IdeaIntersect scan lines with edgesFind ranges along xFill interior of those ranges Don’t fill top/right Edges may NOT matchwith line drawing algo18/95General Polygons – Basic IdeaIntersect scan lines with edgesFind ranges along xFill interior of those ranges Don’t fill top/right Edges may NOT matchwith line drawing algoUse coherence to speed up19/95General Polygons – Basic IdeaIntersect scan lines with edgesFind ranges along xFill interior of those rangesUse coherence to speed upEdges intersecting one scan line are mostly same as those intersecting previous scan line20/95General Polygons – Basic IdeaIntersect scan lines with edgesFind ranges along xFill interior of those rangesUse coherence to speed upThe x-value of an intersection with one scan line is close to the intersection with the previous one21/95How to store polygon edges?22/95General Polygons – Data StructuresSorted Edge Table:01234567Scan LinesEdgesStore a linked-list per scan-line.Insert edges into table at scan-line associated with lowest end-point.23/95General Polygons – Example0123456 701234567ABCDEFG01234567Sorted Edge Table24/95General Polygons – Example0123456 701234567ABCDEFG01234567Sorted Edge Table25/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGSorted Edge Table26/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGSorted Edge TableExclude horizontal edges!27/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG EDSorted Edge Table28/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG EDCDSorted Edge Table29/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG EDCDBCSorted Edge Table30/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG EDCDBCSorted Edge TableWhich edges are intersecting with the current scan line?31/95General Polygons – Data StructuresActive Edge List:EdgesList of all edges intersecting current scan-line sorted by their x-values32/95General Polygons – Data StructuresActive Edge List:EdgesList of all edges intersecting current scan-line sorted by their x-valuesImplement active edge list with linked list33/95General Polygons – Data StructuresActive Edge List:EdgesList of all edges intersecting current scan-line sorted by their x-valuesImplement active edge list with linked listSo what kind of information should be stored in the linked list for our polygon drawing algorithm?34/95General Polygons – Data StructuresEdge:maxY: highest y-valuecurrentX: x-value of end-point with lowest y-valuexIncr: 1 / slopemazYcurrentXxIncrEdge35/95Scan line intersectionkkkkxxyym11Scan line yk+1Scan line ykmxxkk11),(00yxmkxxk0),(endendyx),(11  kkyx),(kkyx36/95Scan line intersection),(11  kkyx),(kkyxkkkkxxyym11Scan line yk+1Scan line ykmxxkk11),(00yxmkxxk0),(endendyx37/95General Polygons – Data StructuresEdge:maxY: highest y-valuecurrentX: x-value of end-point with lowest y-valuexIncr: 1 / slopemazYcurrentXxIncrEdgeHorizontal edges will not be used!!!38/95General Polygons – Algorithmline = 0While (line < height )Add edges to Active Edge List from Sorted Edge Table starting at lineRemove edges that end at lineFill pixelsIncrement x-values on edges in Active Edge ListIncrement line39/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG EDCDBCSorted Edge TableActive Edge List40/95General Polygons – Example0123456 701234567ABCDEFG01234567AB AGFG


View Full Document

TAMU CSCE 441 - lecture3

Documents in this Course
Load more
Download lecture3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lecture3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lecture3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?