10.02.2014 Views

spec - OpenGL

spec - OpenGL

spec - OpenGL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

¦ ¦ ¦ ¦ ¦<br />

¦ ¦ ¦ ¦ ¦<br />

¦ ¦ ¦ ¦ ¦<br />

¦ ¦ ¦ ¦ ¦<br />

3.5. LINE SEGMENTS 231<br />

© © © © <br />

©<br />

© © © © <br />

©<br />

© © © © <br />

©<br />

© © © © <br />

©<br />

¨ ¨ ¨ ¨ <br />

¨<br />

¨ ¨ ¨ ¨ <br />

¨<br />

¨ ¨ ¨ ¨ <br />

¨<br />

¨ ¨ ¨ ¨ <br />

¨<br />

¡ ¡ ¡ ¡<br />

§ § § § § <br />

¡<br />

¡ ¡ ¡ ¡<br />

§ § § § § <br />

¡<br />

¡ ¡ ¡ ¡<br />

§ § § § § <br />

¡<br />

¡ ¡ ¡ ¡<br />

§ § § § § <br />

¡<br />

¢ ¢ ¢ ¢ <br />

¢<br />

¢ ¢ ¢ ¢ <br />

¢<br />

¢ ¢ ¢ ¢ <br />

¢<br />

¢ ¢ ¢ ¢ <br />

¢<br />

£ £ £ £<br />

¤ ¤ ¤ ¤ ¤<br />

¥ ¥ ¥ ¥ ¥<br />

<br />

£<br />

£ £ £ £<br />

¤ ¤ ¤ ¤ ¤<br />

¥ ¥ ¥ ¥ ¥<br />

<br />

£<br />

£ £ £ £<br />

¤ ¤ ¤ ¤ ¤<br />

¥ ¥ ¥ ¥ ¥<br />

<br />

£<br />

£ £ £ £<br />

¤ ¤ ¤ ¤ ¤<br />

¥ ¥ ¥ ¥ ¥<br />

<br />

£<br />

Figure 3.4. Visualization of Bresenham’s algorithm. A portion of a line segment is<br />

shown. A diamond shaped region of height 1 is placed around each fragment center;<br />

those regions that the line segment exits cause rasterization to produce corresponding<br />

fragments.<br />

description are “half-open,” meaning that the final fragment (corresponding to p b )<br />

is not drawn. This means that when rasterizing a series of connected line segments,<br />

shared endpoints will be produced only once rather than twice (as would occur with<br />

Bresenham’s algorithm).<br />

Because the initial and final conditions of the diamond-exit rule may be difficult<br />

to implement, other line segment rasterization algorithms are allowed, subject to<br />

the following rules:<br />

1. The coordinates of a fragment produced by the algorithm may not deviate by<br />

more than one unit in either x or y window coordinates from a corresponding<br />

fragment produced by the diamond-exit rule.<br />

2. The total number of fragments produced by the algorithm may differ from<br />

that produced by the diamond-exit rule by no more than one.<br />

3. For an x-major line, no two fragments may be produced that lie in the same<br />

window-coordinate column (for a y-major line, no two fragments may appear<br />

in the same row).<br />

4. If two line segments share a common endpoint, and both segments are either<br />

x-major (both left-to-right or both right-to-left) or y-major (both bottom-to-<br />

<strong>OpenGL</strong> 4.2 (Compatibility Profile) - August 22, 2011

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!