GLTEXENV(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’– 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 be GL_TEXTURE_ENV. no substitutions, no exceptions, she said what she said. πŸ™…
  • pname β€” specifies the symbolic name of a single-valued texture environment parameter. must be GL_TEXTURE_ENV_MODE. that's the only one allowed here, periodt.
  • param β€” specifies a single symbolic constant, one of GL_MODULATE, GL_DECAL, GL_BLEND, or GL_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 be GL_TEXTURE_ENV. same rule, different function, we stay consistent in this house. πŸ’œ
  • pname β€” specifies the symbolic name of a texture environment parameter. accepted values are GL_TEXTURE_ENV_MODE and GL_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_REPLACE may only be used if the GL version is 1.1 or greater.
  • internal formats other than 1, 2, 3, or 4 may only be used if the GL version is 1.1 or greater.
  • when the GL_ARB_multitexture extension is supported, glTexEnv controls the texture environment for the current active texture unit, selected by glActiveTextureARB. GL_INVALID_ENUM is generated when target or pname is not one of the accepted defined values, or when params should have a defined constant value (based on the value of pname) and does not.
  • GL_INVALID_OPERATION is generated if glTexEnv is executed between the execution of glBegin and the corresponding execution of glEnd.
🚨 bestie, listen: do not call this between glBegin and glEnd. that's a GL_INVALID_OPERATION and it's giving "why would you do that" energy. also watch your GL version before you reach for GL_REPLACE or internal formats that aren't 1, 2, 3, or 4, 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