GLBINDSAMPLER(3G)

πŸ’… GLBINDSAMPLER(3G) β€” bind a named sampler, slay

Okay so this is the glBindSampler page from the 3G manual, bestie, and it’s literally about binding a named sampler to a texturing target. Let’s get into it. ✨


🌸 NAME 🌸

glBindSampler β€” bind a named sampler to a texturing target. Periodt. πŸ’…


🧚 C SPECIFICATION 🧚

The C signature is exactly this, no cap:

void glBindSampler(GLuint unit, GLuint sampler);

πŸŽ€ PARAMETERS πŸŽ€

  • unit β€” the index of the texture unit where the sampler gets bound. Like, which unit are we pulling up to? πŸ‘€
  • sampler β€” the name of a sampler. That’s the one, bestie.

πŸ¦‹ DESCRIPTION πŸ¦‹

glBindSampler binds sampler to the texture unit at index unit. Lowkey important: sampler must be zero or the name of a sampler object previously returned from a call to glGenSamplers(). And unit must be less than the value of GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS. That’s the vibe check, and you gotta pass it. ✨

When a sampler object is bound to a texture unit, its state supersedes that of the texture object bound to that texture unit. Translation: the sampler object is the main character now. πŸ‘‘

If the sampler name zero is bound to a texture unit, the currently bound texture’s sampler state becomes active. And yes, a single sampler object may be bound to multiple texture units simultaneously. Sharing is caring, fr fr. 🫢


πŸ’œ NOTES πŸ’œ

glBindSampler is available only if the GL version is 3.3 or higher. That’s what the page says, so we’re saying it too. πŸ’€


πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_VALUE is generated if unit is greater than or equal to the value of GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS. Too high, bestie β€” invalid.
  • GL_INVALID_OPERATION is generated if sampler is not zero or a name previously returned from a call to glGenSamplers(), or if such a name has been deleted by a call to glDeleteSamplers(). 🫠 That’s a whole situation.

🌈 ASSOCIATED GETS 🌈

  • glGet() with argument GL_SAMPLER_BINDING β€” that’s how you ask what’s bound, iykyk.

⭐ VERSION SUPPORT ⭐

For glBindSampler, the version-support table says this, and I’m keeping every single version name because we do not skip details in this house:

  • OpenGL 2.0 β€” -
  • OpenGL 2.1 β€” -
  • OpenGL 3.0 β€” -
  • OpenGL 3.1 β€” -
  • OpenGL 3.2 β€” βœ”
  • OpenGL 3.3 β€” βœ”
  • OpenGL 4.0 β€” βœ”
  • OpenGL 4.1 β€” βœ”
  • OpenGL 4.2 β€” βœ”
  • OpenGL 4.3 β€” βœ”
  • OpenGL 4.4 β€” βœ”
  • OpenGL 4.5 β€” βœ”

The NOTES section still says β€œ3.3 or higher,” and the table marks 3.2 too β€” both of those are in the original page, so I’m serving both, no editing, no cap. 😭


πŸ“ SEE ALSO πŸ“

  • glGenSamplers()
  • glDeleteSamplers()
  • glGet()
  • glSamplerParameter()
  • glGetSamplerParameter()
  • glGenTextures()
  • glBindTexture()
  • glDeleteTextures()

Copyright Β© 2010-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 Β© 2010-2014 Khronos Group


Source/version footer vibe: [FIXME: source], dated 08/09/2021, stamped GLBINDSAMPLER(3G). Byeee bestie πŸ«ΆπŸ’–

πŸ“¦ where this page comes from