TEXTUREGATHEROFFSETS(3G)

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

πŸ’– TEXTUREGATHEROFFSETS πŸ’–

okay bestie, so this is the textureGatherOffsets page from section 3G of the manual β€” like, the OpenGL Shading Language function pages. It's giving very much "grab four texels at once, but with YOUR OWN custom offsets". Let's get into it πŸ¦‹


✨ NAME ✨

textureGatherOffsets β€” gathers four texels from a texture with an array of offsets πŸ’…


πŸŽ€ DECLARATION πŸŽ€

no cap, here's exactly how you call her:

gvec4 textureGatherOffsets(gsampler2D sampler, vec2 P, ivec2 offsets[4],
                           [int comp]);

gvec4 textureGatherOffsets(gsampler2DArray sampler, vec3 P,
                           ivec2 offsets[4], [int comp]);

gvec4 textureGatherOffsets(gsampler2DRect sampler, vec3 P,
                           ivec2 offsets[4], [int comp]);

vec4 textureGatherOffsets(gsampler2DShadow sampler, vec2 P, float refZ,
                          ivec2 offsets[4]);

vec4 textureGatherOffsets(gsampler2DArrayShadow sampler, vec3 P,
                          float refZ, ivec2 offsets[4]);

vec4 textureGatherOffsets(gsampler2DRectShadow sampler, vec3 P,
                          float refZ, ivec2 offsets[4]);

🌸 PARAMETERS 🌸

  • sampler β€” the sampler your texture is bound to, aka the thing we're stealing texels out of 🫢
  • P β€” the texture coordinates where the sampling happens. your little address in texture-space ✨
  • comp β€” which component of the source texture gets used to build the resulting vector. pick your fighter πŸ’…
  • refZ β€” the reference Z value that the comparison uses in the shadow forms. yes ma'am, comparison time πŸ‘‘
  • offsets β€” an array of offsets from the texture coordinate P, and these are the spots we gather the texels from. literally a lil lineup of coordinates πŸŽ€

πŸ’œ DESCRIPTION πŸ’œ

okay so textureGatherOffsets operates identically to textureGatherOffset(), EXCEPT β€” and this is the whole main character moment β€” offsets is what decides where the four texels get sampled from. 🌈

Each of the four texels comes from taking the offset in offsets, applying it as a (u, v) coordinate offset to P, finding the four-texel GL_LINEAR footprint that lands on, and then selecting texel i0i0 of that footprint. Four offsets, four texels, one function. iconic behavior fr fr πŸ’–

⚠️ heads up bestie: the values you put in offsets must be set with constant integral expressions. not vibes, not runtime math. constant. integral. expressions. periodt.

πŸ‘‘ VERSION SUPPORT πŸ‘‘

so textureGatherOffsets rolled up in OpenGL Shading Language version 4.00 and has been eating ever since. here's the whole timeline, no skipping:

  • OpenGL Shading Language 1.10 β€” - (not here yet πŸ™ˆ)
  • OpenGL Shading Language 1.20 β€” -
  • OpenGL Shading Language 1.30 β€” -
  • OpenGL Shading Language 1.40 β€” -
  • OpenGL Shading Language 1.50 β€” -
  • OpenGL Shading Language 3.30 β€” -
  • OpenGL Shading Language 4.00 β€” βœ” present and thriving ✨
  • OpenGL Shading Language 4.10 β€” βœ”
  • OpenGL Shading Language 4.20 β€” βœ”
  • OpenGL Shading Language 4.30 β€” βœ”
  • OpenGL Shading Language 4.40 β€” βœ”
  • OpenGL Shading Language 4.50 β€” βœ”

πŸ¦‹ SEE ALSO πŸ¦‹

the whole friend group, go say hi πŸ’•

  • texelFetch()
  • texelFetchOffset()
  • texture()
  • textureGather()
  • textureGatherOffset()
  • 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


and that's the whole page bestie!! this lil cutie came from [FIXME: source] and the date on it is 01/03/2018, and it lives in section 3G as TEXTUREGATHEROFFSETS. mwah, go gather some texels πŸ’‹βœ¨

πŸ“¦ where this page comes from