GLTEXBUFFER(3G)

πŸ’– GLTEXBUFFER(3G) β€” glTexBuffer, glTextureBuffer β€” from [FIXME: manual]

okay bestie, welcome to the iconic buffer-texture manual page. This is part 1, and we are keeping every single detail, no cap.


🌸 NAME 🌸

glTexBuffer, glTextureBuffer β€” attach a buffer object's data store to a buffer texture object.


πŸ’» C SPECIFICATION πŸ’»

void glTexBuffer(GLenum target, GLenum internalformat, GLuint buffer);

void glTextureBuffer(GLuint texture, GLenum internalformat,
                     GLuint buffer);

πŸŽ€ PARAMETERS πŸŽ€

  • target β€” specifies the target to which the texture is bound for glTexBuffer. It must be GL_TEXTURE_BUFFER.
  • texture β€” specifies the texture object name for glTextureBuffer.
  • internalformat β€” specifies the internal format of the data in the store belonging to buffer.
  • buffer β€” specifies the name of the buffer object whose storage to attach to the active buffer texture.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe: glTexBuffer and glTextureBuffer attach the data store of a specified buffer object to a specified texture object, and they specify the storage format for the texture image found in the buffer object. The texture object must be a buffer texture. That part is not optional, bestie.

If buffer is zero, any buffer object attached to the buffer texture is detached and no new buffer object is attached. If buffer is non-zero, it must be the name of an existing buffer object. periodt.

bestie, lowkey important: buffer = 0 does the detach thing. buffer β‰  0 has to be an existing buffer object. no cap.

internalformat specifies the storage format, and must be one of the following sized internal formats:

and yes, the original page literally says that sentence twice, so here it is again because I am not dropping a detail: internalformat specifies the storage format, and must be one of the following sized internal formats. iconic of them to repeat it, honestly.

🧚 the sized internal formats β€” all 33 of them 🧚

each line below gives you the sized internal format, then its base type, components, norm, and the component slots 0, 1, 2, 3 exactly like the original table:

  • GL_R8 β€” base type ubyte; components 1; norm YES; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R16 β€” base type ushort; components 1; norm YES; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R16F β€” base type half; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R32F β€” base type float; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R8I β€” base type byte; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R16I β€” base type short; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R32I β€” base type int; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R8UI β€” base type ubyte; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R16UI β€” base type ushort; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_R32UI β€” base type uint; components 1; norm NO; component slots: 0 = R, 1 = 0, 2 = 0, 3 = 1.
  • GL_RG8 β€” base type ubyte; components 2; norm YES; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG16 β€” base type ushort; components 2; norm YES; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG16F β€” base type half; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG32F β€” base type float; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG8I β€” base type byte; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG16I β€” base type short; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG32I β€” base type int; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG8UI β€” base type ubyte; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG16UI β€” base type ushort; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RG32UI β€” base type uint; components 2; norm NO; component slots: 0 = R, 1 = G, 2 = 0, 3 = 1.
  • GL_RGB32F β€” base type float; components 3; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = 1.
  • GL_RGB32I β€” base type int; components 3; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = 1.
  • GL_RGB32UI β€” base type uint; components 3; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = 1.
  • GL_RGBA8 β€” base type uint; components 4; norm YES; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA16 β€” base type short; components 4; norm YES; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA16F β€” base type half; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA32F β€” base type float; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA8I β€” base type byte; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA16I β€” base type short; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA32I β€” base type int; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA8UI β€” base type ubyte; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA16UI β€” base type ushort; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.
  • GL_RGBA32UI β€” base type uint; components 4; norm NO; component slots: 0 = R, 1 = G, 2 = B, 3 = A.

Okay so when a buffer object gets attached to a buffer texture, the buffer object's data store becomes the texture's texel array β€” like, that's the whole vibe. πŸ’«

The number of texels in the buffer texture's texel array is given by:

$$ \left\lfloor {
       size \over { components \times sizeof(base\_type) } } \right\rfloor $$

where $size$ is the size of the buffer object in basic machine units (aka the value of GL_BUFFER_SIZE for buffer), and $components$ and $base_type$ are the element count and base data type for elements, exactly as specified in that table up above. πŸ‘†

Then the number of texels in the texel array gets clamped to the value of the implementation-dependent limit GL_MAX_TEXTURE_BUFFER_SIZE. And heads up bestie β€” when a buffer texture is accessed in a shader, the results of a texel fetch are undefined if the specified texel coordinate is negative, or greater than or equal to the clamped number of texels in the texel array. So like… don't do that. πŸ™ˆ


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_ENUM is generated by glTexBuffer if target is not GL_TEXTURE_BUFFER.
  • GL_INVALID_OPERATION is generated by glTextureBuffer if texture is not the name of an existing texture object.
  • GL_INVALID_ENUM is generated by glTextureBuffer if the effective target of texture is not GL_TEXTURE_BUFFER.
  • GL_INVALID_ENUM is generated if internalformat is not one of the sized internal formats described above.
  • GL_INVALID_OPERATION is generated if buffer is not zero and is not the name of an existing buffer object.

πŸ” ASSOCIATED GETS πŸ”

  • glGet() with argument GL_MAX_TEXTURE_BUFFER_SIZE
  • glGet() with argument GL_TEXTURE_BINDING_BUFFER
  • glGetTexLevelParameter() with argument GL_TEXTURE_BUFFER_DATA_STORE_BINDING

🌈 VERSION SUPPORT 🌈

So the original slaps this in a big grid β€” imma give you the same tea in list form so nothing gets lost. ✨

glTexBuffer β€” no cap, here's exactly when it showed up:

  • 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 β€” βœ”

glTextureBuffer β€” the late bloomer, honestly:

  • 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 β€” βœ”
Lowkey iconic that glTextureBuffer waited until literally 4.5 to make its debut. Main character energy, honestly. πŸ‘‘

🫢 SEE ALSO 🫢

  • glGenBuffers()
  • glBindBuffer()
  • glBufferData()
  • glDeleteBuffers()
  • 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


Okay that's the whole page, bestie β€” you ate that. πŸ’…βœ¨ This one's from the <pink>[FIXME: source]</pink> fam, dated <purple>08/09/2021</purple>, and it answers to the name GLTEXBUFFER(3G) β€” go forth and texture your buffers responsibly, mwah πŸ¦‹πŸŽ€πŸ’–

πŸ“¦ where this page comes from