TEXTUREGATHEROFFSET(3G)

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

πŸ’– TEXTUREGATHEROFFSET πŸ’–

okay bestie, we're doing textureGatherOffset from the 3G manual section today and honestly? it's giving glow-up energy. sit down, hydrate, let's go 🫢


✨ NAME ✨

textureGatherOffset β€” gathers four texels from a texture with offset

like... four texels. at once. with an offset. slay πŸ’…


🌸 DECLARATION 🌸

here's the whole lineup, copy-paste it exactly bestie, don't you dare paraphrase:

gvec4 textureGatherOffset(gsampler2D sampler, vec2 P, ivec2 offset,
                          [int comp]);

gvec4 textureGatherOffset(gsampler2DArray sampler, vec3 P, ivec2 offset,
                          [int comp]);

gvec4 textureGatherOffset(gsampler2DRect sampler, vec3 P, ivec2 offset,
                          [int comp]);

vec4 textureGatherOffset(gsampler2DShadow sampler, vec2 P, float refZ,
                         ivec2 offset);

vec4 textureGatherOffset(gsampler2DArrayShadow sampler, vec3 P,
                         float refZ, ivec2 offset);

vec4 textureGatherOffset(gsampler2DRectShadow sampler, vec3 P,
                         float refZ, ivec2 offset);

notice how the shadow ones get a float refZ instead of an [int comp]? that's not a typo, that's ✨by design✨


πŸŽ€ PARAMETERS πŸŽ€

  • sampler β€” the sampler you've bound the texture to, aka the one you're pulling texels out of. your texture's home address 🏠
  • P β€” the texture coordinates where the sampling happens. where the vibe check occurs πŸ“
  • comp β€” which component of the source texture gets used to build the resulting vector. you're picking a lane πŸ›£οΈ
  • refZ β€” the reference Z value used in the comparison, but only for the shadow forms. shadow girls only πŸ–€
  • offset β€” how far off from that texture coordinate P you're gathering the texels from. the little nudge πŸ‘‰βœ¨

πŸ’œ DESCRIPTION πŸ’œ

so here's literally what textureGatherOffset returns, verbatim:

vec4(Sample_i0_j1(P + offset, base).comp,
     Sample_i1_j1(P + offset, base).comp,
     Sample_i1_j0(P + offset, base).comp,
     Sample_i0_j1(P + offset, base).comp);

(yes, Sample_i0_j1 really does show up twice in there. we don't ask questions, we just gather 🫠)

it perfoms just like textureGather(), except with offset applied exactly as described in textureOffset() β€” with one little twist: the minimum and maximum offset values are implementation-dependent, and they come from GL_MIN_PROGRRAM_TEXTURE_GATHER_OFFSET and GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET, respectively. (spelling of that first one is not on me, I'm reporting the facts, periodt.)

if you do specify comp, its value must ba constant integer expression with a value of 0, 1, 2, or 3, identifying the x, y, z or w component of the four-component vector lookup result for each texel, respectively. and if you don't specify comp? it's treated as 0, selecting the x component of each texel to generate the result. default behaviour, iconic behaviour 😌


🌈 VERSION SUPPORT 🌈

the big question: does your GLSL version even have this? let's find out. the function name is textureGatherOffset and here's the tea per OpenGL Shading Language Version:

  • 1.10 β€” - nope πŸ’€
  • 1.20 β€” - nope πŸ’€
  • 1.30 β€” - nope πŸ’€
  • 1.40 β€” - nope πŸ’€
  • 1.50 β€” - nope πŸ’€
  • 3.30 β€” - nope πŸ’€
  • 4.00 β€” βœ” oh we're SO back πŸ‘‘
  • 4.10 β€” βœ” yes bestie βœ…
  • 4.20 β€” βœ” yes bestie βœ…
  • 4.30 β€” βœ” yes bestie βœ…
  • 4.40 β€” βœ” yes bestie βœ…
  • 4.50 β€” βœ” yes bestie βœ…

so if you're on anything below 4.00, this function simply does not know you. it's not personal. it's just versioning 😭


πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, go say hi:

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

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/.
Copyright Β© 2011-2014 Khronos Group

okay that's the whole page, you ate it, I'm obsessed πŸ’– this was TEXTUREGATHEROFFSET(3G) brought to you from [FIXME: source], dated 01/03/2018 β€” and [FIXME: manual] is literally where it came from, we love a mysterious source. mwah, go gather some texels bestie πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from