textureSize - OpenGL 4 Reference Pages

## Name

textureSize — retrieve the dimensions of a level of a texture

## Declaration

`int textureSize(` | gsampler1D sampler,
| int lod`)`;

`ivec2 textureSize(` | gsampler2D sampler,
| int lod`)`;

`ivec3 textureSize(` | gsampler3D sampler,
| int lod`)`;

`ivec2 textureSize(` | gsamplerCube sampler,
| int lod`)`;

`int textureSize(` | sampler1DShadow sampler,
| int lod`)`;

`ivec2 textureSize(` | sampler2DShadow sampler,
| int lod`)`;

`ivec2 textureSize(` | samplerCubeShadow sampler,
| int lod`)`;

`ivec3 textureSize(` | samplerCubeArray sampler,
| int lod`)`;

`ivec3 textureSize(` | samplerCubeArrayShadow sampler,
| int lod`)`;

`ivec2 textureSize(` | gsamplerRect sampler`)`;

`ivec2 textureSize(` | gsamplerRectShadow sampler`)`;

`ivec2 textureSize(` | gsampler1DArray sampler,
| int lod`)`;

`ivec3 textureSize(` | gsampler2DArray sampler,
| int lod`)`;

`ivec2 textureSize(` | sampler1DArrayShadow sampler,
| int lod`)`;

`ivec3 textureSize(` | sampler2DArrayShadow sampler,
| int lod`)`;

`int textureSize(` | gsamplerBuffer sampler`)`;

`ivec2 textureSize(` | gsampler2DMS sampler`)`;

`ivec3 textureSize(` | gsampler2DMSArray sampler`)`;

## Parameters

`sampler`

  Specifies the sampler to which the texture whose dimensions to retrieve is bound.

`lod`

  Specifies the level of the texture for which to retrieve the dimensions.

## Description

`textureSize` returns the dimensions of level `lod` (if present) of the texture bound to `sampler`. The components in the return value are filled in, in order, with the width, height and depth of the texture. For the array forms, the last component of the return value is the number of layers in the texture array.

## Version Support

| OpenGL Shading Language Version
--- | ---
Function Name | 1.10 | 1.20 | 1.30 | 1.40 | 1.50 | 3.30 | 4.00 | 4.10 | 4.20 | 4.30 | 4.40 | 4.50
textureSize | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
textureSize (samplerBuffer, samplerRect{Shadow}) | - | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔
textureSize (samplerCube{Shadow}) | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔

## See Also

texelFetch, texelFetchOffset, texture, textureGather, textureGatherOffset, textureGatherOffsets, textureGrad, textureGradOffset, textureLod, textureLodOffset, textureOffset, textureProj, textureProjGrad, textureProjGradOffset, textureProjLod, textureProjLodOffset, textureProjOffset, textureQueryLod

## 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/.