1GLSHADEMODEL(3G) OpenGL Manual GLSHADEMODEL(3G)
2
3
4
6 glShadeModel - select flat or smooth shading
7
9 void glShadeModel(GLenum mode);
10
12 mode
13 Specifies a symbolic value representing a shading technique.
14 Accepted values are GL_FLAT and GL_SMOOTH. The initial value is
15 GL_SMOOTH.
16
18 GL primitives can have either flat or smooth shading. Smooth shading,
19 the default, causes the computed colors of vertices to be interpolated
20 as the primitive is rasterized, typically assigning different colors to
21 each resulting pixel fragment. Flat shading selects the computed color
22 of just one vertex and assigns it to all the pixel fragments generated
23 by rasterizing a single primitive. In either case, the computed color
24 of a vertex is the result of lighting if lighting is enabled, or it is
25 the current color at the time the vertex was specified if lighting is
26 disabled.
27
28 Flat and smooth shading are indistinguishable for points. Starting when
29 glBegin() is issued and counting vertices and primitives from 1, the GL
30 gives each flat-shaded line segment i the computed color of vertex i +
31 1, its second vertex. Counting similarly from 1, the GL gives each
32 flat-shaded polygon the computed color of the vertex listed in the
33 following table. This is the last vertex to specify the polygon in all
34 cases except single polygons, where the first vertex specifies the
35 flat-shaded color.
36
37 ┌───────────────────────────────────┬───────────────────────────────────┐
38 │ │ │
39 │ Primitive │ Vertex │
40 │Type of Polygon │ │
41 │ i │ │
42 │ │ │
43 ├───────────────────────────────────┼───────────────────────────────────┤
44 │Single polygon │ 1 │
45 │ ( │ │
46 │ │ │
47 │ │ │
48 │ i │ │
49 │ == │ │
50 │ 1 │ │
51 │ │ │
52 │ ) │ │
53 ├───────────────────────────────────┼───────────────────────────────────┤
54 │Triangle strip │ i │
55 │ │ + │
56 │ │ 2 │
57 ├───────────────────────────────────┼───────────────────────────────────┤
58 │Triangle fan │ i │
59 │ │ + │
60 │ │ 2 │
61 ├───────────────────────────────────┼───────────────────────────────────┤
62 │Independent triangle │ 3 │
63 │ │ │
64 │ │ i │
65 ├───────────────────────────────────┼───────────────────────────────────┤
66 │Quad strip │ 2 │
67 │ │ │
68 │ │ i │
69 │ │ + │
70 │ │ 2 │
71 ├───────────────────────────────────┼───────────────────────────────────┤
72 │Independent quad │ 4 │
73 │ │ │
74 │ │ i │
75 └───────────────────────────────────┴───────────────────────────────────┘
76
77 Flat and smooth shading are specified by glShadeModel with mode set to
78 GL_FLAT and GL_SMOOTH, respectively.
79
81 GL_INVALID_ENUM is generated if mode is any value other than GL_FLAT or
82 GL_SMOOTH.
83
84 GL_INVALID_OPERATION is generated if glShadeModel is executed between
85 the execution of glBegin() and the corresponding execution of glEnd().
86
88 glGet() with argument GL_SHADE_MODEL
89
91 glBegin(), glColor(), glLight(), glLightModel()
92
94 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
95 under the SGI Free Software B License. For details, see
96 http://oss.sgi.com/projects/FreeB/.
97
99 opengl.org
100
101
102
103opengl.org 07/13/2018 GLSHADEMODEL(3G)