TEXTUREOFFSET(3G)

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

TEXTUREOFFSET(3G) πŸ’–

okay bestie, pull up a chair because we're talking about textureOffset from the 3G manual section β€” the GLSL girlie who does a texture lookup but ✨shifted✨. no cap, she's iconic and you're gonna understand her. πŸŽ€


✨ NAME ✨

textureOffset β€” perform a texture lookup with offset πŸ¦‹


🌸 DECLARATION 🌸

here's the whole roster, no skips, all eleven of them, exactly as written:

gvec4 textureOffset(gsampler1D sampler, float P, int offset,
                    [float bias]);

gvec4 textureOffset(gsampler2D sampler, vec2 P, ivec2 offset,
                    [float bias]);

gvec4 textureOffset(gsampler3D sampler, vec3 P, ivec3 offset,
                    [float bias]);

gvec4 textureOffset(gsampler2DRect sampler, vec2 P, ivec2 offset);

float textureOffset(sampler2DRectShadow sampler, vec3 P, ivec2 offset);

float textureOffset(sampler1DShadow sampler, vec3 P, int offset,
                    [float bias]);

float textureOffset(sampler2DShadow sampler, vec4 P, ivec2 offset,
                    [float bias]);

gvec4 textureOffset(gsampler1DArray sampler, vec2 P, int offset,
                    [float bias]);

gvec4 textureOffset(gsampler2DArray sampler, vec3 P, ivec2 offset,
                    [float bias]);

float textureOffset(sampler1DArrayShadow sampler, vec3 P, int offset);

float textureOffset(sampler2DArrayShadow sampler, vec4 P, vec2 offset);
heads up: those [float bias] bits are optional params β€” square brackets mean "if you want her, she's there". πŸ’…

🫢 PARAMETERS 🫢

  • sampler β€” the sampler your texture is bound to. it's literally the doorway to the texels you're about to retrieve. πŸšͺ✨
  • P β€” the texture coordinates where the sampling happens. where you're looking, basically. πŸ‘€
  • offset β€” the offset, measured in texels, that gets applied to P before the texel lookup goes down. it's the little nudge. 🎯

πŸ’œ DESCRIPTION πŸ’œ

okay so textureOffset performs a texture lookup at coordinate P, from the texture bound to sampler, but with an additional offset β€” specified in texels via offset β€” applied to the (u, v, w) texture coordinates before each texel gets looked up. it's giving "same vibe, slightly to the left". 🌈

and the way that offset has to be a constant expression β€” like, no runtime shenanigans, she's fixed at compile time, periodt. πŸ’€

also, only a limited range of offset values are supported. the minimum and maximum offset values are implementation-dependent, and you can find them out by querying GL_MIN_PROGRAM_TEXEL_OFFSET and GL_MAX_PROGRAM_TEXEL_OFFSET, respectively. so check before you yeet an offset in there. πŸ™ˆ

a couple of notes so you don't get caught out:

  • offset does not apply to the layer coordinate for texture arrays. layers stay unbothered. πŸ‘‘
  • offsets are not supported for cube maps. not a thing. don't try it. 🚫🧊

⭐ VERSION SUPPORT ⭐

the OpenGL Shading Language versions in play here are 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 4.00, 4.10, 4.20, 4.30, 4.40, 4.50. here's who shows up when:

  • textureOffset β€” 1.10 βœ— Β· 1.20 βœ— Β· 1.30 βœ” Β· 1.40 βœ” Β· 1.50 βœ” Β· 3.30 βœ” Β· 4.00 βœ” Β· 4.10 βœ” Β· 4.20 βœ” Β· 4.30 βœ” Β· 4.40 βœ” Β· 4.50 βœ”
  • textureOffset (the gsampler2DRect{Shadow} one) β€” 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 yeah, the Rect Shadow girlie showed up fashionably late to the 1.40 party and never left. πŸ’…πŸ”₯


🧚 SEE ALSO 🧚

the whole friend group, go say hi:

texelFetch(), texelFetchOffset(), texture(), textureGather(), textureGatherOffset(), textureGatherOffsets(), textureGrad(), textureGradOffset(), textureLod(), textureLodOffset(), 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 Β© 2012-2014 Khronos Group


cute sign-off bestie: this one came from [FIXME: source], dated 01/03/2018, and it lives under the TEXTUREOFFSET(3G) banner. go forth and offset responsibly. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ
πŸ“¦ where this page comes from