TEXTUREGATHEROFFSET(3G)
π 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 coordinatePyou'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 π
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
- ubuntu jammy: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- ubuntu noble: opengl-4-man-doc 1.0~svn33624-1 Β· SGI-Free-Software-B-License-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms