1GLSHADEMODEL(3G) GLSHADEMODEL(3G)
2
3
4
6 glShadeModel - select flat or smooth shading
7
8
10 void glShadeModel( GLenum mode )
11
12
14 mode Specifies a symbolic value representing a shading technique.
15 Accepted values are GL_FLAT and GL_SMOOTH. The initial value is
16 GL_SMOOTH.
17
19 GL primitives can have either flat or smooth shading. Smooth shading,
20 the default, causes the computed colors of vertices to be interpolated
21 as the primitive is rasterized, typically assigning different colors to
22 each resulting pixel fragment. Flat shading selects the computed color
23 of just one vertex and assigns it to all the pixel fragments generated
24 by rasterizing a single primitive. In either case, the computed color
25 of a vertex is the result of lighting if lighting is enabled, or it is
26 the current color at the time the vertex was specified if lighting is
27 disabled.
28
29 Flat and smooth shading are indistinguishable for points. Starting
30 when glBegin is issued and counting vertices and primitives from 1, the
31 GL gives each flat-shaded line segment i the computed color of vertex
32 i+1, its second vertex. Counting similarly from 1, the GL gives each
33 flat-shaded polygon the computed color of the vertex listed in the fol‐
34 lowing table. This is the last vertex to specify the polygon in all
35 cases except single polygons, where the first vertex specifies the
36 flat-shaded color.
37
38
39 ─────────────────────────────────────
40 Primitive Type of Polygon i Vertex
41 ─────────────────────────────────────
42 Single polygon (i≡1) 1
43 Triangle strip i+2
44 Triangle fan i+2
45 Independent triangle 3i
46 Quad strip 2i+2
47 Independent quad 4i
48 ─────────────────────────────────────
49
50 Flat and smooth shading are specified by glShadeModel with mode set to
51 GL_FLAT and GL_SMOOTH, respectively.
52
54 GL_INVALID_ENUM is generated if mode is any value other than GL_FLAT or
55 GL_SMOOTH.
56
57 GL_INVALID_OPERATION is generated if glShadeModel is executed between
58 the execution of glBegin and the corresponding execution of glEnd.
59
61 glGet with argument GL_SHADE_MODEL
62
64 glBegin(3G), glColor(3G), glLight(3G), glLightModel(3G)
65
66
67
68 GLSHADEMODEL(3G)