TEXTUREQUERYLEVELS(3G)

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

πŸ’– TEXTUREQUERYLEVELS πŸ’–

okay bestie, welcome to textureQueryLevels(3G) β€” yes that's the 3G manual, OpenGL shading language territory, we're in the cool section. this one's short and sweet and honestly iconic. let's go ✨


🌸 NAME 🌸

textureQueryLevels β€” compute the number of accessible mipmap levels of a texture

like... how many mipmaps can we actually touch, bestie. that's the whole job. πŸ’…


πŸŽ€ DECLARATION πŸŽ€

so there's not one declaration, there's thirteen of them, one for every sampler flavor. here they all are, exactly as written, no cap:

int textureQueryLevels(gsampler1D sampler);

int textureQueryLevels(gsampler2D sampler);

int textureQueryLevels(gsampler3D sampler);

int textureQueryLevels(gsamplerCube sampler);

int textureQueryLevels(gsampler1DArray sampler);

int textureQueryLevels(gsampler2DDArray sampler);

int textureQueryLevels(gsamplerCubeArray sampler);

int textureQueryLevels(gsampler1DShadow sampler);

int textureQueryLevels(gsampler2DShadow sampler);

int textureQueryLevels(gsamplerCubeShadow sampler);

int textureQueryLevels(gsampler1DArrayShadow sampler);

int textureQueryLevels(gsampler2DArrayShadow sampler);

int textureQueryLevels(gsamplerCubeArrayShadow sampler);

(and yes, gsampler2DDArray is literally spelled with two D's in there. not me editing that. that's the source, fr fr. πŸ™ˆ)


πŸ¦‹ PARAMETERS πŸ¦‹

  • sampler β€” this is the sampler that the texture is bound to, aka the one whose mipmap level count we're about to go query. it's giving "which texture are we talking about, bestie". πŸ‘‘

🌈 DESCRIPTION 🌈

okay so here's the tea: textureQueryLevels returns the number of accessible mipmap levels in the texture associated with sampler.

that's it. that's the function. it counts mipmap levels and hands you the number. ✨

but listen, there's a little plot twist: if you call it on an incomplete texture, or if there's no texture associated with sampler at all, then you get zero back. not an error, not a crash, just a big fat 0. so if you're getting zero and you're confused... check your texture, babe. 😭


⭐ VERSION SUPPORT ⭐

here's the vibe check on which GLSL versions can run this. the columns are OpenGL Shading Language versions and the rows are... well, one row. it's just textureQueryLevels. πŸ’€

  • Function name: textureQueryLevels
  • GLSL 1.10 β€” - (nope, not supported)
  • GLSL 1.20 β€” - (nope)
  • GLSL 1.30 β€” - (nope)
  • GLSL 1.40 β€” - (nope)
  • GLSL 1.50 β€” - (nope)
  • GLSL 3.30 β€” - (nope)
  • GLSL 4.00 β€” - (nope)
  • GLSL 4.10 β€” - (nope)
  • GLSL 4.20 β€” - (nope)
  • GLSL 4.30 β€” βœ” (YES bestie, we're in)
  • GLSL 4.40 β€” βœ” (still yes)
  • GLSL 4.50 β€” βœ” (yes again)

so basically: 4.30 and up only. everything before that is a dry text back. 🫢


πŸ’œ SEE ALSO πŸ’œ

the whole texture-sampling friend group, go say hi:

  • texelFetch()
  • texelFetchOffset()
  • texture()
  • textureGather()
  • textureGatherOffset()
  • textureGatherOffsets()
  • textureGrad()
  • textureGradOffset()
  • textureLod()
  • textureLodOffset()
  • textureOffset()
  • textureProj()
  • textureProjGrad()
  • textureProjGradOffset()
  • textureProjLod()
  • textureProjLodOffset()
  • textureProjOffset()
  • textureSize()

Copyright Β© 2012-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

legal said I have to include this twice because the original does it twice. I don't make the rules, I just respect them. πŸ’…

and that's the whole page, bestie!! πŸŽ€ one last thing before you go β€” this was [FIXME: source], dated 01/03/2018, and yes the manual is TEXTUREQUERYLEVELS(3G). mwah, go forth and count those mipmaps. πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from