GLGENTEXTURES(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

✨ GLGENTEXTURES ✨ (that's glGenTextures from the 3G manual, bestie)

Okay so picture this: you need texture names, and the GPU is like "say less." That's the whole vibe of this function. Let's get into it πŸ’…


🌸 NAME 🌸

glGenTextures β€” generate texture names, no cap


πŸŽ€ C SPECIFICATION πŸŽ€

void glGenTextures( GLsizei n,
                    GLuint *textures )

Literally the whole signature, character for character, don't @ me 🫢


πŸ¦‹ PARAMETERS πŸ¦‹

  • n β€” the number of texture names you want generated. Like, how many you ordering. πŸ“
  • textures β€” an array where the generated texture names get stored. That's the delivery address, bestie.

πŸ’– DESCRIPTION πŸ’–

So glGenTextures returns n texture names in textures. Iconic.

Now real talk: there is no guarantee that the names form a contiguous set of integers. So don't go assuming 3, 4, 5 β€” they could be scattered, and that's fine, that's just how it is. However β€” and this is the part that actually matters β€” it is guaranteed that none of the returned names was in use immediately before the call to glGenTextures. So no collisions with stuff you already had. Slay. ✨

The generated textures have no dimensionality at this point. They're giving blank canvas, main character energy with no plot yet. They assume the dimensionality of the texture target to which they are first bound β€” see glBindTexture. So the binding is the moment they find themselves, honestly.

And one more thing, super important: texture names returned by a call to glGenTextures are not returned by subsequent calls, unless they are first deleted with glDeleteTextures. So if you want the name back, you gotta free it first. No recycling without permission, periodt. ♻️


⭐ NOTES ⭐

glGenTextures is available only if the GL version is 1.1 or greater. Check your version, bestie, don't get caught out. πŸ™ˆ


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE is generated if n is negative. Negative texture names? Not a thing. Be so serious rn. 😭
  • GL_INVALID_OPERATION is generated if glGenTextures is executed between the execution of glBegin and the corresponding execution of glEnd. So like… not in the middle of that. Just don't. πŸ”₯

🌈 ASSOCIATED GETS 🌈

  • glIsTexture β€” this is your vibe check, iykyk

πŸ‘‘ SEE ALSO πŸ‘‘

glBindTexture(3G), glCopyTexImage1D(3G), glCopyTexImage2D(3G), glDeleteTextures(3G), glGet(3G), glGetTexParameter(3G), glTexImage1D(3G), glTexImage2D(3G), glTexImage3D(3G), glTexParameter(3G)

All the friends in the group chat, fr fr 🧚


Go forth and generate textures. The names are yours, they're just not contiguous and they don't come back unless you delete them first. That's the deal. πŸ’œ

kisses, this page is from the GLGENTEXTURES(3G) manual β€” GLGENTEXTURES(3G) header and footer, bestie, we kept it cute πŸŽ€

πŸ“¦ where this page comes from