Скачиваний:
47
Добавлен:
17.03.2015
Размер:
2.46 Mб
Скачать

2.14. COLORS AND COLORING

70

 

 

 

 

 

Primitive type of polygon i

Vertex

 

 

 

 

 

 

 

 

 

 

single polygon (i ≡ 1)

1

 

 

triangle strip

i + 2

 

 

triangle fan

i + 2

 

 

independent triangle

3i

 

 

quad strip

2i + 2

 

 

independent quad

4i

 

Table 2.12: Polygon flatshading color selection. The colors used for flatshading the ith polygon generated by the indicated Begin/End type are derived from the current color (if lighting is disabled) in effect when the indicated vertex is specified. If lighting is enabled, the colors are produced by lighting the indicated vertex. Vertices are numbered 1 through n, where n is the number of vertices between the

Begin/End pair.

2.14.8 Color and Associated Data Clipping

After lighting, clamping or masking and possible flatshading, colors are clipped. Those colors associated with a vertex that lies within the clip volume are unaffected by clipping. If a primitive is clipped, however, the colors assigned to vertices produced by clipping are clipped colors.

Let the colors assigned to the two vertices P1 and P2 of an unclipped edge be c1 and c2. The value of t (section 2.12) for a clipped point P is used to obtain the color associated with P as

c = tc1 + (1 − t)c2.

(For a color index color, multiplying a color by a scalar means multiplying the index by the scalar. For an RGBA color, it means multiplying each of R, G, B, and A by the scalar. Both primary and secondary colors are treated in the same fashion.) Polygon clipping may create a clipped vertex along an edge of the clip volume’s boundary. This situation is handled by noting that polygon clipping proceeds by clipping against one plane of the clip volume’s boundary at a time. Color clipping is done in the same way, so that clipped points always occur at the intersection of polygon edges (possibly already clipped) with the clip volume’s boundary.

Texture and fog coordinates, vertex shader varying variables (section 2.15.3), and point sizes computed on a per vertex basis must also be clipped when a primitive is clipped. The method is exactly analogous to that used for color clipping.

Version 2.0 - October 22, 2004

Соседние файлы в папке OpenGL