TEXTUREGRADOFFSET(3G)

πŸ“¦
version 1.0~svn33624 Β· 4 versions
, in ubuntu jammy, ubuntu noble

πŸ’– TEXTUREGRADOFFSET πŸ’–

okay so bestie, this is the TEXTUREGRADOFFSET(3G) page β€” a whole manual page about one (1) GLSL function and honestly? she's serving. grab a snack, we're doing texture lookups with explicit gradients and an offset. no cap. 🫢


✨ NAME ✨

textureGradOffset β€” perform a texture lookup with explicit gradients and offset.

that's it. that's the whole job. iconic behavior. πŸ‘‘


πŸŽ€ DECLARATION πŸŽ€

okay so there are literally twelve overloads and every single one of them is here, verbatim, do not come for me:

gvec4 textureGradOffset(gsampler1D sampler, float P, float dPdx,
                        float dPdy, int offset);

gvec4 textureGradOffset(gsampler2D sampler, vec2 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

gvec4 textureGradOffset(gsampler3D sampler, vec3 P, vec3 dPdx,
                        vec3 dPdy, ivec3 offset);

gvec4 textureGradOffset(gsampler2DRect sampler, vec2 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

float textureGradOffset(gsampler2DRectShadow sampler, vec3 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

float textureGradOffset(sampler1DShadow sampler, vec3 P, float dPdx,
                        float dPdy, int offset);

float textureGradOffset(sampler2DShadow sampler, vec3 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

gvec4 textureGradOffset(gsampler1DArray sampler, vec2 P, float dPdx,
                        float dPdy, int offset);

gvec4 textureGradOffset(gsampler2DArray sampler, vec3 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

float textureGradOffset(sampler1DArrayShadow sampler, vec3 P,
                        float dPdx, float dPdy, int offset);

float textureGradOffset(sampler2DArrayShadow sampler, vec3 P, vec2 dPdx,
                        vec2 dPdy, ivec2 offset);

slay. 🌈


🌸 PARAMETERS 🌸

  • sampler β€” the sampler you're working with. it's the thing the texture you're pulling texels out of is bound to, so like… pick the right one bestie. πŸ™ˆ
  • P β€” the texture coordinates where the sampling happens. this is where you're pointing.
  • dPdx β€” the partial derivative of P with respect to window x. yes, a real derivative. math class showed up. 😭
  • dPdy β€” the partial derivative of P with respect to window y. same energy, other axis.
  • offset β€” the offset that gets applied to the texture coordinates before sampling. so it moves first, then the lookup happens. important order, don't skip it. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

textureGradOffset does a texture lookup at coordinate P, pulling from the texture bound to sampler, and it uses explicit texture coordinate gradients β€” the ones you hand it in dPdx and dPdy. so no automatic derivative nonsense, you're the main character here, you supply them. ✨

you also pass an explicit offset in offset. so this function is basically two vibes in a trench coat: it takes dPdx and dPdy exactly the way textureGrad() does, and it takes offset exactly the way textureOffset() does. that's the whole concept. two functions, one function. the way that it just combines them. πŸ”₯


πŸ‘‘ VERSION SUPPORT πŸ‘‘

here's the receipts, broken out so you can actually read them (the original is a big grid and I love her but a girl needs a list):

  • textureGradOffset β€” 1.10 -, 1.20 -, 1.30 βœ”, 1.40 βœ”, 1.50 βœ”, 3.30 βœ”, 4.00 βœ”, 4.10 βœ”, 4.20 βœ”, 4.30 βœ”, 4.40 βœ”, 4.50 βœ”
  • textureGradOffset (gsampler2DRect{Shadow}) β€” 1.10 -, 1.20 -, 1.30 -, 1.40 βœ”, 1.50 βœ”, 3.30 βœ”, 4.00 βœ”, 4.10 βœ”, 4.20 βœ”, 4.30 βœ”, 4.40 βœ”, 4.50 βœ”

so like, the 2DRect shadow variant didn't show up until 1.40, and the base one landed in 1.30. 1.10 and 1.20 are giving nothing for this function. πŸ’€


πŸ’… SEE ALSO πŸ’…

your homework, bestie, all of it:

texelFetch(), texelFetchOffset(), texture(), textureGather(), textureGatherOffset(), textureGatherOffsets(), textureGrad(), textureLod(), textureLodOffset(), textureOffset(), textureProj(), textureProjGrad(), textureProjGradOffset(), textureProjLod(), textureProjLodOffset(), textureProjOffset(), textureQueryLod(), textureSize()

iykyk. 🧚


Copyright Β© 2011-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

and again, because the page says it twice and I respect the bit:

Copyright Β© 2011-2014 Khronos Group

okay that's the page!! 🌟 one last thing for the sign-off: this came out of [FIXME: source], dated 01/03/2018, and it's the TEXTUREGRADOFFSET(3G) page. take care of her, she's been through a lot of overloads. mwah. πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from