Difference between revisions of "GLAPI/glTexBuffer"

From OpenGL.org
Jump to: navigation, search
m (Bot: Adding better formatting.)
m (Bot: Adding better formatting.)
Line 11: Line 11:
  
 
; target
 
; target
: Specifies the target of the operation and must be {{code|GL_TEXTURE_BUFFER}}.
+
: Specifies the target of the operation and must be {{enum|GL_TEXTURE_BUFFER}}.
 
; internalFormat
 
; internalFormat
 
: Specifies the internal format of the data in the store belonging to {{param|buffer}}.
 
: Specifies the internal format of the data in the store belonging to {{param|buffer}}.
Line 19: Line 19:
 
== Description ==
 
== Description ==
  
'''glTexBuffer''' attaches the storage for the buffer object named {{param|buffer}} to the active buffer texture, and specifies the internal format for the texel array found in the attached buffer object. If {{param|buffer}} is zero, any buffer object attached to the buffer texture is detached and no new buffer object is attached. If {{param|buffer}} is non-zero, it must be the name of an existing buffer object. {{param|target}} must be {{code|GL_TEXTURE_BUFFER}}. {{param|internalformat}} specifies the storage format, and must be one of the following sized internal formats:
+
'''glTexBuffer''' attaches the storage for the buffer object named {{param|buffer}} to the active buffer texture, and specifies the internal format for the texel array found in the attached buffer object. If {{param|buffer}} is zero, any buffer object attached to the buffer texture is detached and no new buffer object is attached. If {{param|buffer}} is non-zero, it must be the name of an existing buffer object. {{param|target}} must be {{enum|GL_TEXTURE_BUFFER}}. {{param|internalformat}} specifies the storage format, and must be one of the following sized internal formats:
  
 
{|
 
{|
Line 38: Line 38:
 
| 3
 
| 3
 
|+
 
|+
| {{code|GL_R8}}
+
| {{enum|GL_R8}}
 
| ubyte
 
| ubyte
 
| 1
 
| 1
Line 47: Line 47:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R16}}
+
| {{enum|GL_R16}}
 
| ushort
 
| ushort
 
| 1
 
| 1
Line 56: Line 56:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R16F}}
+
| {{enum|GL_R16F}}
 
| half
 
| half
 
| 1
 
| 1
Line 65: Line 65:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R32F}}
+
| {{enum|GL_R32F}}
 
| float
 
| float
 
| 1
 
| 1
Line 74: Line 74:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R8I}}
+
| {{enum|GL_R8I}}
 
| byte
 
| byte
 
| 1
 
| 1
Line 83: Line 83:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R16I}}
+
| {{enum|GL_R16I}}
 
| short
 
| short
 
| 1
 
| 1
Line 92: Line 92:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R32I}}
+
| {{enum|GL_R32I}}
 
| int
 
| int
 
| 1
 
| 1
Line 101: Line 101:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R8UI}}
+
| {{enum|GL_R8UI}}
 
| ubyte
 
| ubyte
 
| 1
 
| 1
Line 110: Line 110:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R16UI}}
+
| {{enum|GL_R16UI}}
 
| ushort
 
| ushort
 
| 1
 
| 1
Line 119: Line 119:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_R32UI}}
+
| {{enum|GL_R32UI}}
 
| uint
 
| uint
 
| 1
 
| 1
Line 128: Line 128:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG8}}
+
| {{enum|GL_RG8}}
 
| ubyte
 
| ubyte
 
| 2
 
| 2
Line 137: Line 137:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG16}}
+
| {{enum|GL_RG16}}
 
| ushort
 
| ushort
 
| 2
 
| 2
Line 146: Line 146:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG16F}}
+
| {{enum|GL_RG16F}}
 
| half
 
| half
 
| 2
 
| 2
Line 155: Line 155:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG32F}}
+
| {{enum|GL_RG32F}}
 
| float
 
| float
 
| 2
 
| 2
Line 164: Line 164:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG8I}}
+
| {{enum|GL_RG8I}}
 
| byte
 
| byte
 
| 2
 
| 2
Line 173: Line 173:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG16I}}
+
| {{enum|GL_RG16I}}
 
| short
 
| short
 
| 2
 
| 2
Line 182: Line 182:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG32I}}
+
| {{enum|GL_RG32I}}
 
| int
 
| int
 
| 2
 
| 2
Line 191: Line 191:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG8UI}}
+
| {{enum|GL_RG8UI}}
 
| ubyte
 
| ubyte
 
| 2
 
| 2
Line 200: Line 200:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG16UI}}
+
| {{enum|GL_RG16UI}}
 
| ushort
 
| ushort
 
| 2
 
| 2
Line 209: Line 209:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RG32UI}}
+
| {{enum|GL_RG32UI}}
 
| uint
 
| uint
 
| 2
 
| 2
Line 218: Line 218:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RGB32F}}
+
| {{enum|GL_RGB32F}}
 
| float
 
| float
 
| 3
 
| 3
Line 227: Line 227:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RGB32I}}
+
| {{enum|GL_RGB32I}}
 
| int
 
| int
 
| 3
 
| 3
Line 236: Line 236:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RGB32UI}}
+
| {{enum|GL_RGB32UI}}
 
| uint
 
| uint
 
| 3
 
| 3
Line 245: Line 245:
 
| 1
 
| 1
 
|+
 
|+
| {{code|GL_RGBA8}}
+
| {{enum|GL_RGBA8}}
 
| uint
 
| uint
 
| 4
 
| 4
Line 254: Line 254:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA16}}
+
| {{enum|GL_RGBA16}}
 
| short
 
| short
 
| 4
 
| 4
Line 263: Line 263:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA16F}}
+
| {{enum|GL_RGBA16F}}
 
| half
 
| half
 
| 4
 
| 4
Line 272: Line 272:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA32F}}
+
| {{enum|GL_RGBA32F}}
 
| float
 
| float
 
| 4
 
| 4
Line 281: Line 281:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA8I}}
+
| {{enum|GL_RGBA8I}}
 
| byte
 
| byte
 
| 4
 
| 4
Line 290: Line 290:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA16I}}
+
| {{enum|GL_RGBA16I}}
 
| short
 
| short
 
| 4
 
| 4
Line 299: Line 299:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA32I}}
+
| {{enum|GL_RGBA32I}}
 
| int
 
| int
 
| 4
 
| 4
Line 308: Line 308:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA8UI}}
+
| {{enum|GL_RGBA8UI}}
 
| ubyte
 
| ubyte
 
| 4
 
| 4
Line 317: Line 317:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA16UI}}
+
| {{enum|GL_RGBA16UI}}
 
| ushort
 
| ushort
 
| 4
 
| 4
Line 326: Line 326:
 
| A
 
| A
 
|+
 
|+
| {{code|GL_RGBA32UI}}
+
| {{enum|GL_RGBA32UI}}
 
| uint
 
| uint
 
| 4
 
| 4
Line 340: Line 340:
 
<math>\left \lfloor \tfrac{buffer\_size}{components \times sizeof(base\_type)} \right \rfloor </math>
 
<math>\left \lfloor \tfrac{buffer\_size}{components \times sizeof(base\_type)} \right \rfloor </math>
  
where ''buffer_size'' is the size of the buffer object, in basic machine units 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 implementation-dependent limit {{code|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.
+
where ''buffer_size'' is the size of the buffer object, in basic machine units 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 implementation-dependent limit {{enum|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 ==
 
== Errors ==
  
{{code|GL_INVALID_ENUM}} is generated if {{param|target}} is not {{code|GL_TEXTURE_BUFFER}}.
+
{{enum|GL_INVALID_ENUM}} is generated if {{param|target}} is not {{enum|GL_TEXTURE_BUFFER}}.
  
{{code|GL_INVALID_ENUM}} is generated if {{param|internalFormat}} is not one of the accepted tokens.
+
{{enum|GL_INVALID_ENUM}} is generated if {{param|internalFormat}} is not one of the accepted tokens.
  
{{code|GL_INVALID_OPERATION}} is generated if {{param|buffer}} is not zero or the name of an existing buffer object.
+
{{enum|GL_INVALID_OPERATION}} is generated if {{param|buffer}} is not zero or the name of an existing buffer object.
  
 
== Notes ==
 
== Notes ==
Line 356: Line 356:
 
== Associated Gets ==
 
== Associated Gets ==
  
{{apifunc|glGet}} with argument {{code|GL_MAX_TEXTURE_BUFFER_SIZE}}
+
{{apifunc|glGet}} with argument {{enum|GL_MAX_TEXTURE_BUFFER_SIZE}}
  
{{apifunc|glGet}} with argument {{code|GL_TEXTURE_BINDING_BUFFER}}
+
{{apifunc|glGet}} with argument {{enum|GL_TEXTURE_BINDING_BUFFER}}
  
{{apifunc|glGetTexLevelParameter}} with argument {{code|GL_TEXTURE_BUFFER_DATA_STORE_BINDING}}
+
{{apifunc|glGetTexLevelParameter}} with argument {{enum|GL_TEXTURE_BUFFER_DATA_STORE_BINDING}}
  
 
== See Also ==
 
== See Also ==

Revision as of 13:29, 29 April 2012

glTexBuffer
Core in version 4.5
Core since version 3.0

glTexBuffer: attach the storage for a buffer object to the active buffer texture

Function Definition

 void glTexBuffer(GLenum target​, GLenum internalFormat​, Gluintbuffer​);
target
Specifies the target of the operation and must be GL_TEXTURE_BUFFER.
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

glTexBuffer attaches the storage for the buffer object named buffer​ to the active buffer texture, and specifies the internal format for the texel array found in the attached buffer object. 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. target​ must be GL_TEXTURE_BUFFER. internalformat​ specifies the storage format, and must be one of the following sized internal formats:

Component
Sized Internal Format Base Type Components Norm 0 1 2 3
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 {\tfrac  {buffer\_size}{components\times sizeof(base\_type)}}\right\rfloor

where buffer_size is the size of the buffer object, in basic machine units 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 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 if target​ is not GL_TEXTURE_BUFFER.

GL_INVALID_ENUM is generated if internalFormat​ is not one of the accepted tokens.

GL_INVALID_OPERATION is generated if buffer​ is not zero or the name of an existing buffer object.

Notes

glTexBuffer is available only if the GL version is 3.1 or greater.

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

See Also

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

Copyright

Copyright © 2010 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/.