GLSHADEMODEL(3G)
β¨ glShadeModel β¨
okay bestie, welcome to glShadeModel(3G) β the lil GL function that decides whether your primitives get their colors blended all cute and smooth, or slapped on flat like a sticker. it's giving very important, very short, and you're gonna slay it. π
π C SPECIFICATION π
void glShadeModel( GLenum mode )
like, that's it. one arg. one job. iconic behavior honestly. π
πΈ PARAMETERS πΈ
modeβ specifies a symbolic value representing a shading technique. the accepted values areGL_FLATandGL_SMOOTH. the initial value isGL_SMOOTH.
π¦ DESCRIPTION π¦
so GL primitives can have either flat or smooth shading, and ngl those two vibes are very different.
Smooth shading is the default, and it causes the computed colors of vertices to be interpolated as the primitive is rasterized β typically assigning different colors to each resulting pixel fragment. it's the gradient girlie. the blend. the soft glow. β¨
Flat shading selects the computed color of just one vertex and assigns it to all the pixel fragments generated by rasterizing a single primitive. no blending, just commitment. it's giving monochrome.
and in either case β hear me out β the computed color of a vertex is the result of lighting if lighting is enabled, or it is the current color at the time the vertex was specified if lighting is disabled. fr fr. that's the rule. π«Ά
k so here's the tea: flat and smooth shading are indistinguishable for points. like, literally cannot tell. periodt.
but for the other primitives? buckle up. starting when glBegin is issued and counting vertices and primitives from 1, the GL gives each flat-shaded line segment i the computed color of vertex i+1, its second vertex. so the second vertex is the one running the show. main character energy for real. π
counting similarly from 1, the GL gives each flat-shaded polygon the computed color of the vertex listed in the following table. this is the last vertex to specify the polygon in all cases except single polygons, where the first vertex specifies the flat-shaded color. (yes bestie, single polygons are the exception, don't come for me.)
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
flat and smooth shading are specified by glShadeModel with mode set to GL_FLAT and GL_SMOOTH, respectively. that's the whole thing. π
π ERRORS π
GL_INVALID_ENUMis generated ifmodeis any value other thanGL_FLATorGL_SMOOTH. like, don't try it. it will not work. πGL_INVALID_OPERATIONis generated ifglShadeModelis executed between the execution ofglBeginand the corresponding execution ofglEnd. so do NOT be calling this mid-primitive, bestie, that's not the vibe. π
π ASSOCIATED GETS π
glGetwith argumentGL_SHADE_MODEL
π SEE ALSO π
glBegin(3G)glColor(3G)glLight(3G)glLightModel(3G)
and that's the whole page, babe β GLSHADEMODEL(3G), living in manual section 3G, brought to you by the source/version line and date that live down at the bottom of the original page. mwah. go shade something gorgeous. ππΈπ¦β¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms