CS 543: Computer Graphics. Rasterization

Similar documents
Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

? Which intermediate. Recall: Line drawing algorithm. Programmer specifies (x,y) of end pixels Need algorithm to determine pixels on line path

CS 4731/543: Computer Graphics Lecture 7 (Part I): Raster Graphics: Polygons & Antialiasing. Emmanuel Agu

Computer Graphics CS 543 Lecture 11 (Part 1) Polygon Filling & Antialiasing

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

Painter s HSR Algorithm

COMP371 COMPUTER GRAPHICS

Rasterization, or What is glbegin(gl_lines) really doing?

Rasterization: Geometric Primitives

Graphics (Output) Primitives. Chapters 3 & 4

Chapter 8: Implementation- Clipping and Rasterization

1 Introduction to Graphics

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

From Ver(ces to Fragments: Rasteriza(on

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

Raster Scan Displays. Framebuffer (Black and White)

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Computer Graphics. - Rasterization - Philipp Slusallek

Einführung in Visual Computing

Pipeline implementation II

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Chapter - 2: Geometry and Line Generations

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

UNIT 2 GRAPHIC PRIMITIVES

EF432. Introduction to spagetti and meatballs

Computer Graphics Geometry and Transform

CS488 2D Graphics. Luc RENAMBOT

CS 130 Final. Fall 2015

Scan Conversion. Drawing Lines Drawing Circles

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

Topic #1: Rasterization (Scan Conversion)

EF432. Introduction to spagetti and meatballs

Scan Converting Lines

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Rendering. Basic Math Review. Rasterizing Lines and Polygons Hidden Surface Remove Multi-pass Rendering with Accumulation Buffers.

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

CS Computer Graphics: Hidden Surface Removal

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

Rendering. A simple X program to illustrate rendering

COMP3421. Particle Systems, Rasterisation

Rasterization. COMP 575/770 Spring 2013

Computer Graphics Lecture Notes

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Pipeline and Rasterization. COMP770 Fall 2011

Line Drawing Week 6, Lecture 9

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

Chapter 3. Sukhwinder Singh

Rasterization. CS4620 Lecture 13

Computer Graphics (CS 543) Lecture 9 (Part 2): Clipping. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

CSCI 4620/8626. Coordinate Reference Frames

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Realtime 3D Computer Graphics Virtual Reality

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

CS452/552; EE465/505. Clipping & Scan Conversion

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

More on Coordinate Systems. Coordinate Systems (3) Coordinate Systems (2) Coordinate Systems (5) Coordinate Systems (4) 9/15/2011

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

The Traditional Graphics Pipeline

CS4620/5620: Lecture 14 Pipeline

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Attributes of Graphics Primitives

Shading Techniques Denbigh Starkey

Clipping and Scan Conversion

Overview of Computer Graphics

Scan Converting Circles

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

CS Computer Graphics: Raster Graphics, Part 3

RASTERIZING POLYGONS IN IMAGE SPACE

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

(Refer Slide Time: 00:02:00)

Rasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]

The Traditional Graphics Pipeline

CS Rasterization. Junqiao Zhao 赵君峤

Computer Graphics Geometry and Transform

Efficient Plotting Algorithm

UNIT -8 IMPLEMENTATION

The Traditional Graphics Pipeline

Topics. From vertices to fragments

CS 325 Computer Graphics

Transcription:

CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots of help from Prof. Emmanuel Agu :-)

2D Graphics Pipeline! Simplified Clipping Object in World Coordinates Apply world window Object subset window to viewport mapping Simple 2D Drawing Pipeline Display Rasterization Object in Screen coordinates R.W. Lindeman - WPI Dept. of Computer Science 2

Rasterization (Scan Conversion)! Convert high-level geometry description to pixel colors in the frame buffer! Example: given vertex x, y coordinates, determine pixel colors to draw line! Two ways to create an image " Scan existing photograph " Procedurally compute values (rendering) Viewport Transformation Rasterization R.W. Lindeman - WPI Dept. of Computer Science 3

Rasterization! A fundamental computer graphics function! Determine the pixels' colors, illuminations, textures, etc.! Implemented by graphics hardware! Rasterization algorithms " Lines " Circles " Triangles " Polygons R.W. Lindeman - WPI Dept. of Computer Science 4

Rasterization Operations! Drawing lines on the screen! Manipulating pixel maps (pixmaps): copying, scaling, rotating, etc.! Compositing images, defining and modifying regions! Drawing and filling polygons " Previously gl.drawarrays( )!! Aliasing and antialiasing methods R.W. Lindeman - WPI Dept. of Computer Science 5

Compositing Example R.W. Lindeman - WPI Dept. of Computer Science 6

Line Drawing Algorithm! Programmer specifies (x, y) values of end pixels! Need algorithm to figure out which intermediate pixels are on line path! Pixel (x, y) values constrained to integer values! Actual computed intermediate line values may be floats! Rounding may be required, e.g., computed point (10.48, 20.51) rounded to (10, 21)! Rounded pixel value is off actual line path (jaggy!!)! Sloped lines end up having jaggies, but vertical, horizontal lines don't R.W. Lindeman - WPI Dept. of Computer Science 7

Line Drawing Algorithm (cont.) 8 7 6 5? 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 Line: (3,2) -> (9,6) Which intermediate pixels should we light? R.W. Lindeman - WPI Dept. of Computer Science 8

Line Drawing Algorithm (cont.)! Slope-intercept line equation " y = mx + b " Given two end points (x 0, y 0 ), (x 1, y 1 ), how do we compute m and b? (x 1, y 1 ) m = d y d x = y 1 y 0 x 1 x 0 d y (x 0, y 0 ) d x b = y 0 m * x 0 R.W. Lindeman - WPI Dept. of Computer Science 9

Line Drawing Algorithm (cont.)! Numerical example of finding slope m:! (A x, A y ) = (23, 41), (B x, B y ) = (125, 96) m = B y A y B x A x = 96 41 125 23 = 55 102 = 0.5392 R.W. Lindeman - WPI Dept. of Computer Science 10

Line Drawing Algorithm: Digital Differential Analyzer (DDA)! Walk through the line, starting at (x 0,y 0 )! Constrain x, y increments to values in [0,1] range! Case a: x is incrementing faster (m < 1) " Step in x=1 increments, compute and round y! Case b: y is incrementing faster (m > 1) " Step in y=1 increments, compute and round x (x 1, y 1 ) d y m>1 m=1 (x 0, y 0 ) d x m<1 R.W. Lindeman - WPI Dept. of Computer Science 11

DDA Line Drawing Algorithm (Case a: m < 1) yk +1 = yk + m (x 1, y 1 ) x = x 0 y = y 0 Illuminate pixel (x, round(y)) x = x 0 + 1 y = y 0 + m Illuminate pixel (x, round(y)) x = x + 1 y = y + m Illuminate pixel (x, round(y)) Until x == x 1 (x 0, y 0 ) R.W. Lindeman - WPI Dept. of Computer Science 12

DDA Line Drawing Algorithm (Case b: m > 1) x k + 1 = xk + 1 m (x 1, y 1 ) x = x 0 y = y 0 Illuminate pixel (round(x), y) y = y 0 + 1 x = x 0 + 1/m Illuminate pixel (round(x), y) y = y + 1 x = x + 1/m Illuminate pixel (round(x), y) Until y == y 1 (x 0, y 0 ) R.W. Lindeman - WPI Dept. of Computer Science 13

DDA Line Drawing Algorithm Pseudocode compute m; if m < 1 float y = y 0 ; // initial value for( int x = x 0 ; x <= x 1 ; x++, y += m ) setpixel( x, round(y) ); else // m > 1 float x = x 0 ; // initial value for( int y = y 0 ; y <= y 1 ; y++, x += 1/m ) setpixel( round(x), y );! Note: setpixel(x, y) writes current color into pixel in column x and row y in frame buffer R.W. Lindeman - WPI Dept. of Computer Science 14

Line Drawing Algorithm Drawbacks! DDA is the simplest line drawing algorithm " Not very efficient " Round operation is expensive! Optimized algorithms typically used " Integer DDA! e.g., Bresenham's algorithm (Hill, 9.4.1)! Bresenham's algorithm " Incremental algorithm: current value uses previous value " Integers only: avoid floating point arithmetic " Several versions of algorithm: we'll describe midpoint version of algorithm R.W. Lindeman - WPI Dept. of Computer Science 15

Bresenham's Line-Drawing Algorithm! Problem " Given endpoints (A x, A y ) and (B x, B y ) of a line, want to determine best sequence of intervening pixels! First make two simplifying assumptions (remove later): " (A x < B x ) and " (0 < m < 1)! Define " Width W = B x A x " Height H = B y - A y (A x, A y ) (B x, B y ) R.W. Lindeman - WPI Dept. of Computer Science 16

Bresenham's Line-Drawing Algorithm (cont.)! Based on assumptions " W, H are positive " H < W! As x steps in +1 increments, y incr/decr by <= +/ 1! y value sometimes stays same, sometimes increases by 1 " Midpoint algorithm determines which happens R.W. Lindeman - WPI Dept. of Computer Science 17

Bresenham's Line-Drawing Algorithm (cont.) (x 1, y 1 ) What Pixels do we need to turn on? Consider pixel midpoint M(M x, M y ) M = (x 0 + 1, Y 0 + ½) Build equation of line through and compare to midpoint If midpoint is above line, y stays same If midpoint is below line, y increases + 1 (x 0, y 0 ) R.W. Lindeman - WPI Dept. of Computer Science 18

Bresenham's Line-Drawing Algorithm (cont.)! To get a good line equation, use similar triangles y x Ay Ax = H W (x, y) (B x, B y ) (A x, A y ) H(x A x ) = W(y A y ) -W(y A y ) + H(x A x ) = 0! Above is ideal equation of line through (A x, A y ) and (B x, B y )! Thus, any point (x, y) that lies on ideal line makes eqn = 0! Double expression (to avoid floats later), and give it a name, F(x, y) = -2W(y A y ) + 2H(x A x ) R.W. Lindeman - WPI Dept. of Computer Science 19

Bresenham's Line-Drawing Algorithm (cont.)! So, F(x, y) = -2W(y A y ) + 2H(x A x )! Algorithm " If:! F(x, y) < 0, (x, y) above line! F(x, y) > 0, (x, y) below line! Hint: F(x, y) = 0 is on line! Increase y keeping x constant, F(x, y) becomes more negative R.W. Lindeman - WPI Dept. of Computer Science 20

Bresenham's Line-Drawing Algorithm (cont.)! Example " To find line segment between (3, 7) and (9, 11) F(x,y) = -2W(y A y ) + 2H(x A x ) = (-12)(y 7) + (8)(x 3)! For points on line, e.g., (7, 29/3), F(x, y) = 0! A = (4, 4) lies below line since F = 44 (> 0)! B = (5, 9) lies above line since F = -8 (< 0) R.W. Lindeman - WPI Dept. of Computer Science 21

Bresenham's Line-Drawing Algorithm (cont.) (x 1, y 1 ) What Pixels do we need to turn on? Consider pixel midpoint M(M x, M y ) M = (x 0 + 1, Y 0 + ½) If F(M x, M y ) < 0, M lies above line, shade lower pixel (same y as before) If F(M x, M y ) > 0, M lies below line, shade upper pixel (y = y + 1) (x 0, y 0 ) R.W. Lindeman - WPI Dept. of Computer Science 22

Bresenham's Line-Drawing Algorithm (cont.)! We can compute F(x, y) incrementally " Initially, midpoint M = (A x + 1, A y + ½)! F(M x, M y ) = -2W(y A y ) + 2H(x A x ) = 2H W " Can compute F(x, y) for next midpoint incrementally " If we increment x + 1, y stays same F(M x, M y ) += 2H " If we increment x +1, y + 1 F(M x, M y ) += 2(W H) R.W. Lindeman - WPI Dept. of Computer Science 23

Bresenham's Line-Drawing Algorithm (cont.) Bresenham( IntPoint a, IntPoint b ) { // restriction: a.x < b.x and 0 < H/W < 1 int y = a.y, W = b.x a.x, H = b.y a.y; int F = 2 * H W; // current error term for(int x = a.x; x <= b.x; x++) { setpixel at (x, y); // to desired color value if F < 0 F += 2H; else { y++; F += 2(H W) } } }! Recall: F is the equation of a line R.W. Lindeman - WPI Dept. of Computer Science 24

Bresenham's Line-Drawing Algorithm (cont.)! Final words: we developed algorithm with restrictions 0 < m < 1 and Ax < Bx! Can add code to remove restrictions " To get the same line when A x > B x (swap and draw) " Lines having m > 1 (interchange x with y) " Lines with m < 0 (step x++, decrement y not incr) " Horizontal and vertical lines (pretest a.x = b.x and skip other tests) R.W. Lindeman - WPI Dept. of Computer Science 25

Rasterization So Far...! Raster graphics " Line-drawing algorithms (DDA, Bresenham's)! Now " Defining and filling Regions " Polygon drawing and filling " Antialiasing R.W. Lindeman - WPI Dept. of Computer Science 26

Defining and Filling Regions of Pixels! First, understand how to define and fill any defined regions! Next, how to fill regions bounded by a polygon R.W. Lindeman - WPI Dept. of Computer Science 27

Methods of Defining Regions! Pixel-defined " Specifies pixels in color or geometric range! Symbolic " Provides property that pixels in region must have! Examples of symbolic regions! Closeness to some pixel! Within circle of radius R! Within a specified polygon R.W. Lindeman - WPI Dept. of Computer Science 28

Pixel-Defined Regions! Definition: Region R is the set of all pixels having color C that are connected to a given pixel S! 4-adjacent: Pixels that lie next to each other horizontally or vertically, NOT diagonally! 8-adjacent: 4-adjacent, plus diagonals! 4-connected: If there is unbroken path of 4- adjacent pixels! 8-connected: Unbroken path of 8-adjacent pixels R.W. Lindeman - WPI Dept. of Computer Science 29

Recursive Flood-Fill Algorithm! Recursive algorithm! Starts from initial pixel of color initcolor! Recursively set 4-connected neighbors to newcolor! Flood-Fill: floods region with newcolor! Basic idea: " Start at "seed" pixel (x, y) " If (x, y) has color initcolor, change it to newcolor " Do same recursively for all 4 neighbors R.W. Lindeman - WPI Dept. of Computer Science 30

Recursive Flood-Fill Algorithm (cont.) void floodfill( short x, short y, short initcolor ) { if( getpixel( x, y ) == initcolor ) { setpixel( x, y ); floodfill( x 1, y, initcolor ); // left floodfill( x + 1, y, initcolor ); // right floodfill( x, y + 1, initcolor ); // up floodfill( x, y 1, initcolor ); // down } }! Note: getpixel(x,y) used to interrogate pixel color at (x, y) R.W. Lindeman - WPI Dept. of Computer Science 31

Recursive Flood-Fill Algorithm (cont.)! Okay, now you try it. R.W. Lindeman - WPI Dept. of Computer Science 32

Recursive Flood-Fill Algorithm (cont.)! This version defines region using initcolor! Can also have version defining region by boundary! Recursive flood-fill is somewhat blind " Some pixels may be retested several times before algorithm terminates! Region coherence is likelihood that an interior pixel will be adjacent to another interior pixel! Coherence can be used to improve algorithm performance! A run is a group of adjacent pixels lying on same scan line! Exploit runs of pixels R.W. Lindeman - WPI Dept. of Computer Science 33

Region Filling Using Coherence! Start at seed s R.W. Lindeman - WPI Dept. of Computer Science 34

Region Filling Using Coherence Pseudocode Push address of seed pixel onto stack while(stack is not empty) { } Pop the stack to provide next seed Fill in the run defined by the seed In the row above, find the reachable interior runs Push the address of their rightmost pixels Do the same for row below current run Note: Most efficient if there is span coherence (pixels on scan line have same value) and scan-line coherence (consecutive scan lines are similar) R.W. Lindeman - WPI Dept. of Computer Science 35

Filling Polygon-Defined Regions! Problem: Region defined by Polygon P with vertices P i = (X i, Y i ), for i = 1 N, specifying sequence of P's vertices P1 P2 P7 P3 P5 P6 R.W. Lindeman - WPI Dept. of Computer Science 36 P4

Filling Polygon-Defined Regions (cont.)! Solution: Progress through frame buffer, scan line by scan line, filling in appropriate portions of each line! Filled portions defined by intersection of scan line and polygon edges! Runs lying between edges inside P are filled R.W. Lindeman - WPI Dept. of Computer Science 37

Filling Polygon-Defined Regions Pseudocode for(each scan Line L) { } Find intersections of L with all edges of P Sort the intersections by increasing x-value Fill pixel runs between all pairs of intersections R.W. Lindeman - WPI Dept. of Computer Science 38

Filling Polygon-Defined Regions (cont.)! Example: scan line y = 3 intersects 4 edges e 3, e 4, e 5, e 6! Sort x values of intersections and fill runs in pairs! Note: At each intersection, use inside-outside (parity), or vice versa e 7 P 1 e 1 P 2 e 2 P 7 P 3 e 6 e 3 3 P 5 e 5 e 4 P 6 P 4 R.W. Lindeman - WPI Dept. of Computer Science 39

Filling Polygon-Defined Regions (cont.)! What if two polygons A, B share an edge?! Algorithm behavior could result in " Setting edge first in one color and then another " Drawing edge twice too bright! Make Rule: When two polygons share edge, each polygon owns its left and bottom edges! E.g., below draw shared edge with color of polygon B A B R.W. Lindeman - WPI Dept. of Computer Science 40

Filling Polygon-Defined Regions (cont.)! How do we handle cases where scan line intersects with polygon endpoints?! Solution: Discard intersections with horizontal edges, and with upper endpoint of any edge R.W. Lindeman - WPI Dept. of Computer Science 41

Antialiasing! Raster displays have pixels as rectangles! Aliasing: Discrete nature of pixels introduces "jaggies" R.W. Lindeman - WPI Dept. of Computer Science 42

Antialiasing (cont.)! Aliasing effects " Distant objects may disappear entirely " Objects can blink on and off in animations! Antialiasing techniques involve some form of blurring to reduce contrast, smooth image! Three main antialiasing techniques " Prefiltering " Supersampling " Postfiltering R.W. Lindeman - WPI Dept. of Computer Science 43

Prefiltering! Basic idea " Compute area of polygon coverage " Use proportional intensity value! Example: if polygon covers 1/2 of the pixel " use 1/2 polygon color " add it to 1/2 of adjacent region color! Cons: computing pixel coverage can be time consuming R.W. Lindeman - WPI Dept. of Computer Science 44

Supersampling! Useful if we can compute color of any (x,y) value on the screen! Increase frequency of sampling! Instead of (x,y) samples in increments of 1, sample (x,y) in fractional (e.g., 1/2) increments! Find average of samples! Example: Triple sampling = increments of 1/2 = 9 color values averaged for each pixel Average 9 (x, y) values to find pixel color R.W. Lindeman - WPI Dept. of Computer Science 45

Postfiltering! Supersampling uses average! Gives all samples equal importance! Postfiltering: use weighting (different levels of importance) " Compute pixel value as weighted average " Samples close to pixel center given more weight Sample weighting 1/16 1/16 1/16 1/16 1/2 1/16 1/16 1/16 1/16 R.W. Lindeman - WPI Dept. of Computer Science 46

Antialiasing in OpenGL! Many alternatives! Simplest: Accumulation buffer " Extra storage, similar to frame buffer! Samples are accumulated! When all slightly perturbed samples are done, copy results to frame buffer and draw R.W. Lindeman - WPI Dept. of Computer Science 47

Antialiasing in OpenGL (cont.)! First initialize glutinitdisplaymode( GLUT_SINGLE GLUT_RGB GLUT_ACCUM GLUT_DEPTH );! Zero out accumulation buffer " glclear( GLUT_ACCUM_BUFFER_BIT );! Add samples to accumulation buffer using glaccum( ) R.W. Lindeman - WPI Dept. of Computer Science 48

OpenGL Antialiasing Sample Code glclear( GL_ACCUM_BUFFER_BIT ); for( int i = 0; i < 8; i++ ) { } cam.slide(f*jitter[i].x, f*jitter[i].y, 0); display( ); glaccum( GL_ACCUM, 1/8.0 ); glaccum( GL_RETURN, 1.0 );! jitter[] stores randomized slight displacements of camera, jitter.h -0.3348, 0.4353 0.2864, -0.3934! Factor, f controls amount of overall sliding R.W. Lindeman - WPI Dept. of Computer Science 49...

Antialiasing Example R.W. Lindeman - WPI Dept. of Computer Science 50

Antialiasing Example R.W. Lindeman - WPI Dept. of Computer Science 51