Light | Dark

# docs.GL

GLSL 4
GLSL ES 3

# textureOffset

## Name

textureOffset — perform a texture lookup with offset

## Declaration

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

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

`float textureOffset(` | sampler2DShadow sampler,
| vec3 P,
| ivec2 offset,
| [float bias]`)`;

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

## Parameters

`sampler`

  Specifies the sampler to which the texture from which texels will be retrieved is bound.

`P`

  Specifies the texture coordinates at which texture will be sampled.

`offset`

  Specifies offset, in texels that will be applied to `P` before looking up the texel.

`bias`

  Specifies an optional bias to be applied during level-of-detail computation.

## Description

`textureOffset` performs a texture lookup at coordinate `P` from the texture bound to `sampler` with an an additional offset, specified in texels in `offset` that will be applied to the (u, v, w) texture coordinates before looking up each texel. The offset value must be a constant expression. A limited range of offset values are supported; the minimum and maximum offset values are implementation-dependent and may be determined by querying `GL_MIN_PROGRAM_TEXEL_OFFSET` and `GL_MAX_PROGRAM_TEXEL_OFFSET`, respectively.

Note that `offset` does not apply to the layer coordinate for texture arrays. Also note that offsets are not supported for cube maps.

## Version Support

| OpenGL ES Shading Language Version
--- | ---
Function Name | 1.00 | 3.00 | 3.10
textureOffset | - | ✔ | ✔

## See Also

texelFetch, texelFetchOffset, texture, textureGrad, textureGradOffset, textureLod, textureLodOffset, textureProj, textureProjGrad, textureProjGradOffset, textureProjLod, textureProjLodOffset, textureProjOffset, 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. https://opencontent.org/openpub/.

Think you can improve this page? Edit this page on GitHub.