GLTEXENV(3G)
π NAME π
hi bestie, welcome to the GLTEXENV(3G) manual page β¨
this is the one about glTexEnvf, glTexEnvi, glTexEnvfv, glTexEnviv β aka set texture environment parameters. that's it. that's the whole job. she sets the vibe of your texture env and she does it flawlessly. π
π C SPECIFICATION π
void glTexEnvf( GLenum target,
GLenum pname,
GLfloat param )
void glTexEnvi( GLenum target,
GLenum pname,
GLint param )
πΈ PARAMETERS πΈ
targetβ specifies a texture environment. must beGL_TEXTURE_ENV. no substitutions, no exceptions, she said what she said. πpnameβ specifies the symbolic name of a single-valued texture environment parameter. must beGL_TEXTURE_ENV_MODE. that's the only one allowed here, periodt.paramβ specifies a single symbolic constant, one ofGL_MODULATE,GL_DECAL,GL_BLEND, orGL_REPLACE. pick your fighter. π
π C SPECIFICATION π (yes, again β the vector girlies π¦)
void glTexEnvfv( GLenum target,
GLenum pname,
const GLfloat *params )
void glTexEnviv( GLenum target,
GLenum pname,
const GLint *params )
πΈ PARAMETERS πΈ
targetβ specifies a texture environment. must beGL_TEXTURE_ENV. same rule, different function, we stay consistent in this house. πpnameβ specifies the symbolic name of a texture environment parameter. accepted values areGL_TEXTURE_ENV_MODEandGL_TEXTURE_ENV_COLOR. two options, both iconic.paramsβ specifies a pointer to a parameter array that contains either a single symbolic constant or an RGBA color. yes, it's a pointer. yes, you have to actually have the array. ngl, she's flexible like that. π§
π DESCRIPTION π
okay so, a texture environment specifies how texture values are interpreted when a fragment is textured. target must be GL_TEXTURE_ENV. pname can be either GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR. that's the whole menu, bestie. π
if pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the symbolic name of a texture function. four texture functions may be specified: GL_MODULATE, GL_DECAL, GL_BLEND, and GL_REPLACE.
a texture function acts on the fragment to be textured using the texture image value that applies to the fragment (see glTexParameter) and produces an RGBA color for that fragment. the following table shows how the RGBA color is produced for each of the three texture functions that can be chosen. C is a triple of color values (RGB) and A is the associated alpha value. RGBA values extracted from a texture image are in the range [0,1]. the subscript f refers to the incoming fragment, the subscript t to the texture image, the subscript c to the texture environment color, and subscript v indicates a value produced by the texture function. lowkey a whole alphabet soup but stay with me, it slaps once you see it. π₯
a texture image can have up to four components per texture element (see glTexImage1D, glTexImage2D, glTexImage3D, glCopyTexImage1D, and glCopyTexImage2D). in a one-component image, Lt indicates that single component. a two-component image uses Lt and At. a three-component image has only a color value, Ct. a four-component image has both a color value Ct and an alpha value At. π«
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Base internal Texture functions
GL_MODULATE GL_DECAL GL_BLEND GL_REPLACE
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_ALPHA Cv=Cf undefined Cv=Cf Cv=Cf
Av=AfAt Av=Af Av=At
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_LUMINANCE Cv=LtCf undefined Cv=(1βLt)Cf Cv=Lt
+LtCc
1 Av=Af Av=Af Av=Af
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_LUMINANCE Cv=LtCf undefined Cv=(1βLt)Cf Cv=Lt
\f3_ALPHA +LtCc
2 Av=AtAf Av=AtAf Av=At
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_INTENSITY Cv=CfIt undefined Cv=(1βIt)Cf Cv=It
+ItCc
c Av=AfIt Av=(1βIt)Af Av=It
+ItAc
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_RGB Cv=CtCf Cv=Ct Cv=(1βCt)Cf Cv=Ct
+CtCc
3 Av=Af Av=Af Av=Af Av=Af
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GL_RGBA Cv=CtCf Cv=(1βAt)Cf Cv=(1βCt)Cf Cv=Ct
+AtCt +CtCc
4 Av=AtAf Av=Af Av=AtAf Av=At
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
if pname is GL_TEXTURE_ENV_COLOR, params is a pointer to an array that holds an RGBA color consisting of four values. integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0. the values are clamped to the range [0,1] when they are specified. Cc takes these four values. she clamps, she doesn't negotiate. π
GL_TEXTURE_ENV_MODE defaults to GL_MODULATE and GL_TEXTURE_ENV_COLOR defaults to (0, 0, 0, 0). free defaults, we love a generous queen. π
β NOTES β
GL_REPLACEmay only be used if the GL version is1.1or greater.- internal formats other than
1,2,3, or4may only be used if the GL version is1.1or greater. - when the
GL_ARB_multitextureextension is supported,glTexEnvcontrols the texture environment for the current active texture unit, selected byglActiveTextureARB.GL_INVALID_ENUMis generated whentargetorpnameis not one of the accepted defined values, or whenparamsshould have a defined constant value (based on the value ofpname) and does not. GL_INVALID_OPERATIONis generated ifglTexEnvis executed between the execution ofglBeginand the corresponding execution ofglEnd.
π¨ bestie, listen: do not call this betweenglBeginandglEnd. that's aGL_INVALID_OPERATIONand it's giving "why would you do that" energy. also watch your GL version before you reach forGL_REPLACEor internal formats that aren't1,2,3, or4, because those are version-gated. read the room, then read the version. π
π«Ά ASSOCIATED GETS π«Ά
glGetTexEnv
π¦ SEE ALSO π¦
glActiveTextureARB(3G)glCopyPixels(3G)glCopyTexImage1D(3G)glCopyTexImage2D(3G)glCopyTexSubImage1D(3G)glCopyTexSubImage2D(3G)glCopyTexSubImage3D(3G)glTexImage1D(3G)glTexImage2D(3G)glTexImage3D(3G)glTexParameter(3G)glTexSubImage1D(3G)glTexSubImage2D(3G)glTexSubImage3D(3G)
and that's the page, babe π the footer stamps this whole thing as GLTEXENV(3G) β that's the source/version tag and the date line rolled into one, and it's the last word on this page. go texture something gorgeous, you absolute icon. πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms