glTexBufferRange.3G - Man Page

attach a range of a buffer object's data store to a buffer texture object

C Specification

void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);

void glTextureBufferRange(GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizei size);

Parameters

target

Specifies the target to which the texture object is bound for glTexBufferRange. Must be GL_TEXTURE_BUFFER.

texture

Specifies the texture object name for glTextureBufferRange.

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.

offset

Specifies the offset of the start of the range of the buffer's data store to attach.

size

Specifies the size of the range of the buffer's data store to attach.

Description

glTexBufferRange and glTextureBufferRange attach a range of the data store of a specified buffer object to a specified texture object, and specify the storage format for the texture image 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.

The start and size of the range are specified by offset and size respectively, both measured in basic machine units. offset must be greater than or equal to zero, size must be greater than zero, and the sum of offset and size must not exceed the value of GL_BUFFER_SIZE for buffer. Furthermore, offset must be an integer multiple of the value of GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT.

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

    Component
Sized Internal FormatBase TypeComponentsNorm0123
GL_R8ubyte1YESR001
GL_R16ushort1YESR001
GL_R16Fhalf1NOR001
GL_R32Ffloat1NOR001
GL_R8Ibyte1NOR001
GL_R16Ishort1NOR001
GL_R32Iint1NOR001
GL_R8UIubyte1NOR001
GL_R16UIushort1NOR001
GL_R32UIuint1NOR001
GL_RG8ubyte2YESRG01
GL_RG16ushort2YESRG01
GL_RG16Fhalf2NORG01
GL_RG32Ffloat2NORG01
GL_RG8Ibyte2NORG01
GL_RG16Ishort2NORG01
GL_RG32Iint2NORG01
GL_RG8UIubyte2NORG01
GL_RG16UIushort2NORG01
GL_RG32UIuint2NORG01
GL_RGB32Ffloat3NORGB1
GL_RGB32Iint3NORGB1
GL_RGB32UIuint3NORGB1
GL_RGBA8uint4YESRGBA
GL_RGBA16short4YESRGBA
GL_RGBA16Fhalf4NORGBA
GL_RGBA32Ffloat4NORGBA
GL_RGBA8Ibyte4NORGBA
GL_RGBA16Ishort4NORGBA
GL_RGBA32Iint4NORGBA
GL_RGBA8UIubyte4NORGBA
GL_RGBA16UIushort4NORGBA
GL_RGBA32UIuint4NORGBA

When a range of a buffer object is attached to a buffer texture, the specified range of 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 $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 glTexBufferRange if target is not GL_TEXTURE_BUFFER.

GL_INVALID_OPERATION is generated by glTextureBufferRange if texture is not the name of an existing texture object.

GL_INVALID_ENUM is generated by glTextureBufferRange 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.

GL_INVALID_VALUE is generated if offset is negative, if size is less than or equal to zero, or if offset + size is greater than the value of GL_BUFFER_SIZE for buffer.

GL_INVALID_VALUE is generated if offset is not an integer multiple of the value of GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT.

Associated Gets

glGet() with argument GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT

glGetTexLevelParameter() with arguments GL_TEXTURE_BUFFER_OFFSET or GL_TEXTURE_BUFFER_SIZE.

Version Support

OpenGL Version
Function / Feature Name2.02.13.03.13.23.34.04.14.24.34.44.5
glTexBufferRange---------
glTextureBufferRange-----------

See Also

glTexBuffer().

Referenced By

The man page glTextureBufferRange.3G(3) is an alias of glTexBufferRange.3G(3).

07/18/2024