void LineStipple ( int factor, ushort pattern ) ;
defines a line stipple. pattern is an unsigned short integer. The line stipple is taken from the lowest order 16 bits of pattern. It determines those fragments that are to be drawn when the line is rasterized. factor is a count that is used to modify the effective line stipple by causing each bit in line stipple to be used factor times. is clamped to the range . Line stippling may be enabled or disabled using Enable or Disable with the constant LINE_STIPPLE. When disabled, it is as if the line stipple has its default value.
Line stippling masks certain fragments that are produced by rasterization so that they are not sent to the per-fragment stage of the GL. The masking is achieved using three parameters: the 16-bit line stipple p, the line repeat count r, and an integer stipple counter s. Let
Then a fragment is produced if the bth bit of p is 1, and not produced otherwise. The bits of p are numbered with 0 being the least significant and 15 being the most significant. The initial value of s is zero; s is incremented after production of each fragment of a line segment (fragments are produced in order, beginning at the starting point and working towards the ending point). s is reset to 0 whenever a Begin occurs, and before every line segment in a group of independent segments (as specified when Begin is invoked with LINES).
If the line segment has been clipped, then the value of s at the beginning of the line segment is indeterminate.