TEXTUREOFFSET(3G)
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 toPbefore 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:
offsetdoes 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(thegsampler2DRect{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 π
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], dated01/03/2018, and it lives under theTEXTUREOFFSET(3G)banner. go forth and offset responsibly. mwah. πβ¨ππ¦πΈ
π¦ 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