logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

glTexBuffer, glTextureBuffer - attach a buffer object's data store to a buffer texture object

Associated Gets

glGet() with argument GL_MAX_TEXTURE_BUFFER_SIZEglGet() with argument GL_TEXTURE_BINDING_BUFFERglGetTexLevelParameter() with argument GL_TEXTURE_BUFFER_DATA_STORE_BINDING

C Specification

voidglTexBuffer(GLenumtarget,GLenuminternalFormat,GLuintbuffer);voidglTextureBuffer(GLuinttexture,GLenuminternalformat,GLuintbuffer);

Description

glTexBuffer and glTextureBuffer attaches the data store of a specified buffer object to a specified
       texture object, and specify the storage format for the texture image found found in the buffer object.
       The texture object must be a buffer texture.

       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.

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

       internalformat specifies the storage format, and must be one of the following sized internal formats:
       ┌─────────────┬───────────┬────────────┬──────┬───────────────┐
       │             │           │            │      │   Component   │
       ├─────────────┼───────────┼────────────┼──────┼───┬───┬───┬───┤
       │ SizedBaseTypeComponentsNorm0123 │
       │ Internal    │           │            │      │   │   │   │   │
       │ Format      │           │            │      │   │   │   │   │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R8       │ ubyte     │ 1          │ YES  │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R16      │ ushort    │ 1          │ YES  │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R16F     │ half      │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R32F     │ float     │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R8I      │ byte      │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R16I     │ short     │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R32I     │ int       │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R8UI     │ ubyte     │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R16UI    │ ushort    │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_R32UI    │ uint      │ 1          │ NO   │ R │ 0 │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG8      │ ubyte     │ 2          │ YES  │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG16     │ ushort    │ 2          │ YES  │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG16F    │ half      │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG32F    │ float     │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG8I     │ byte      │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG16I    │ short     │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG32I    │ int       │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG8UI    │ ubyte     │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG16UI   │ ushort    │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RG32UI   │ uint      │ 2          │ NO   │ R │ G │ 0 │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGB32F   │ float     │ 3          │ NO   │ R │ G │ B │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGB32I   │ int       │ 3          │ NO   │ R │ G │ B │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGB32UI  │ uint      │ 3          │ NO   │ R │ G │ B │ 1 │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA8    │ uint      │ 4          │ YES  │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA16   │ short     │ 4          │ YES  │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA16F  │ half      │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA32F  │ float     │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA8I   │ byte      │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA16I  │ short     │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA32I  │ int       │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA8UI  │ ubyte     │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA16UI │ ushort    │ 4          │ NO   │ R │ G │ B │ A │
       ├─────────────┼───────────┼────────────┼──────┼───┼───┼───┼───┤
       │ GL_RGBA32UI │ uint      │ 4          │ NO   │ R │ G │ B │ A │
       └─────────────┴───────────┴────────────┴──────┴───┴───┴───┴───┘

       When a buffer object is attached to a buffer texture, the buffer object's data store is taken as the
       texture's texel array. 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 (the value of GL_BUFFER_SIZE for buffer), and
       $components$ and $base\_type$ are the element count and base data type for elements, as specified in the
       table above. The number of texels in the texel array is then clamped to the value of the
       implementation-dependent limit GL_MAX_TEXTURE_BUFFER_SIZE. 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.

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.

Name

       glTexBuffer, glTextureBuffer - attach a buffer object's data store to a buffer texture object

Parameters

target
           Specifies the target to which the texture is bound for glTexBuffer. 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.

See Also

glGenBuffers(), glBindBuffer(), glBufferData(), glDeleteBuffers(), glGenTextures(), glBindTexture(),
       glDeleteTextures()

Version Support

       ┌─────────────────┬───────────────────────────────────────────────────────────────────────┐
       │                 │                OpenGLVersion                                         │
       ├─────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │ Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │ /               │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Feature         │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Name            │     │     │     │     │     │     │     │     │     │     │     │     │
       ├─────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glTexBuffer     │  -  │  -  │  -  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
       ├─────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glTextureBuffer │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │
       └─────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

See Also