GLAPI/glBindBufferRange: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
End (talk | contribs)
m Corrected misspelling.
 
(14 intermediate revisions by 2 users not shown)
Line 8: Line 8:
== Function Definition ==
== Function Definition ==


   void '''glBindBufferRange'''(GLenum ''target'', GLuint ''index'', GLuint ''buffer'', GLintptr ''offset'', GLsizeiptr ''size'');
   void '''glBindBufferRange'''(GLenum {{param|target}}, GLuint {{param|index}}, GLuint {{param|buffer}}, GLintptr {{param|offset}}, GLsizeiptr {{param|size}});


; target
{{glapi indexbuffertargets}}
: Specify the target of the bind operation. ''target'' must be one of {{code|GL_ATOMIC_COUNTER_BUFFER}}, {{code|GL_TRANSFORM_FEEDBACK_BUFFER}} or {{code|GL_UNIFORM_BUFFER}}.
; index
; index
: Specify the index of the binding point within the array specified by ''target''.
: Specify the index of the binding point within the array specified by {{param|target}}.
; buffer
; buffer
: The name of a buffer object to bind to the specified binding point.
: The name of a buffer object to bind to the specified binding point.
; offset
; offset
: The starting offset in basic machine units into the buffer object ''buffer''.
: The starting offset in basic machine units into the buffer object {{param|buffer}}.
; size
; size
: The amount of data in machine units that can be read from the buffet object while used as an indexed target.
: The amount of data in machine units that can be read from the buffer object while used as an indexed target.


== Description ==
== Description ==


'''glBindBufferRange''' binds a range the buffer object ''buffer'' represented by ''offset'' and ''size'' to the binding point at index ''index'' of the array of targets specified by ''target''. Each ''target'' represents an indexed array of buffer binding points, as well as a single general binding point that can be used by other buffer manipulation functions such as [[GLAPI/glBindBuffer|glBindBuffer]] or [[GLAPI/glMapBuffer|glMapBuffer]]. In addition to binding a range of ''buffer'' to the indexed buffer binding target, '''glBindBufferBase''' also binds the range to the generic buffer binding point specified by ''target''.
'''glBindBufferRange''' binds a range the buffer object {{param|buffer}} represented by {{param|offset}} and {{param|size}} to the binding point at index {{param|index}} of the array of targets specified by {{param|target}}. Each {{param|target}} represents an indexed array of buffer binding points, as well as a single general binding point that can be used by other buffer manipulation functions such as {{apifunc|glBindBuffer}} or {{apifunc|glMapBuffer}}. In addition to binding a range of {{param|buffer}} to the indexed buffer binding target, '''glBindBufferRange''' also binds the range to the generic buffer binding point specified by {{param|target}}.


''offset'' specifies the offset in basic machine units into the buffer object ''buffer'' and ''size'' specifies the amount of data that can be read from the buffer object while used as an indexed target.
{{param|offset}} specifies the offset in basic machine units into the buffer object {{param|buffer}} and {{param|size}} specifies the amount of data that can be read from the buffer object while used as an indexed target.


== Notes ==
== Notes ==


The {{code|GL_ATOMIC_COUNTER_BUFER}} target is available only if the GL version is 4.2 or greater.
The {{enum|GL_ATOMIC_COUNTER_BUFER}} target is available only if the GL version is 4.2 or greater.
 
The {{enum|GL_SHADER_STORAGE_BUFFER}} target is available only if the GL version is 4.3 or greater.


== Errors ==
== Errors ==


{{code|GL_INVALID_ENUM}} is generated if ''target'' is not one of {{code|GL_ATOMIC_COUNTER_BUFFER}}, {{code|GL_TRANSFORM_FEEDBACK_BUFFER}} or {{code|GL_UNIFORM_BUFFER}}.
{{enum|GL_INVALID_ENUM}} is generated if {{param|target}} is not one of {{enum|GL_ATOMIC_COUNTER_BUFFER}}, {{enum|GL_TRANSFORM_FEEDBACK_BUFFER}}, {{enum|GL_UNIFORM_BUFFER}} or {{enum|GL_SHADER_STORAGE_BUFFER}}.


{{code|GL_INVALID_VALUE}} is generated if ''index'' is greater than or equal to the number of ''target''-specific indexed binding points.
{{enum|GL_INVALID_VALUE}} is generated if {{param|index}} is greater than or equal to the number of {{param|target}}-specific indexed binding points.


{{code|GL_INVALID_VALUE}} is generated if ''size'' is less than or equal to zero, or if ''offset'' + ''size'' is greater than the value of {{code|GL_BUFFER_SIZE}}.
{{enum|GL_INVALID_VALUE}} is generated if {{param|size}} is less than or equal to zero, or if {{param|offset}} + {{param|size}} is greater than the value of {{enum|GL_BUFFER_SIZE}}.


Additional errors may be generated if ''offset'' violates any ''target''-specific alignmemt restrictions.
Additional errors may be generated if {{param|offset}} violates any {{param|target}}-specific alignmemt restrictions.


== See Also ==
== See Also ==


[[GLAPI/glGenBuffers|glGenBuffers]], [[GLAPI/glDeleteBuffers|glDeleteBuffers]], [[GLAPI/glBindBuffer|glBindBuffer]], [[GLAPI/glBindBufferBase|glBindBufferBase]], [[GLAPI/glMapBuffer|glMapBuffer]], [[GLAPI/glUnmapBuffer|glUnmapBuffer]],
{{apifunc|glBindBuffersRange}}, {{apifunc|glGenBuffers}}, {{apifunc|glDeleteBuffers}}, {{apifunc|glIsBuffer}}, {{apifunc|glBindBuffer}}, {{apifunc|glBindBufferBase}}, {{apifunc|glMapBufferRange}}, {{apifunc|glUnmapBuffer}},


== Copyright ==
== Copyright ==
Line 49: Line 50:
Copyright © 2010-2011 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/ http://opencontent.org/openpub/].
Copyright © 2010-2011 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/ http://opencontent.org/openpub/].


[[Category:API Reference 4|BindBufferRange]]
[[Category:Core API Ref Buffer Objects|BindBufferRange]]
[[Category:Core API Reference|BindBufferRange]]

Latest revision as of 13:59, 21 December 2014

glBindBufferRange
Core in version 4.6
Core since version 3.0

glBindBufferRange: bind a range within a buffer object to an indexed buffer target

Function Definition

 void glBindBufferRange(GLenum target​, GLuint index​, GLuint buffer​, GLintptr offset​, GLsizeiptr size​);
target
Specifies the target buffer object. The symbolic constant must be GL_ATOMIC_COUNTER_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER, GL_UNIFORM_BUFFER or GL_SHADER_STORAGE_BUFFER.
index
Specify the index of the binding point within the array specified by target​.
buffer
The name of a buffer object to bind to the specified binding point.
offset
The starting offset in basic machine units into the buffer object buffer​.
size
The amount of data in machine units that can be read from the buffer object while used as an indexed target.

Description

glBindBufferRange binds a range the buffer object buffer​ represented by offset​ and size​ to the binding point at index index​ of the array of targets specified by target​. Each target​ represents an indexed array of buffer binding points, as well as a single general binding point that can be used by other buffer manipulation functions such as glBindBuffer or glMapBuffer. In addition to binding a range of buffer​ to the indexed buffer binding target, glBindBufferRange also binds the range to the generic buffer binding point specified by target​.

offset​ specifies the offset in basic machine units into the buffer object buffer​ and size​ specifies the amount of data that can be read from the buffer object while used as an indexed target.

Notes

The GL_ATOMIC_COUNTER_BUFER target is available only if the GL version is 4.2 or greater.

The GL_SHADER_STORAGE_BUFFER target is available only if the GL version is 4.3 or greater.

Errors

GL_INVALID_ENUM is generated if target​ is not one of GL_ATOMIC_COUNTER_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER, GL_UNIFORM_BUFFER or GL_SHADER_STORAGE_BUFFER.

GL_INVALID_VALUE is generated if index​ is greater than or equal to the number of target​-specific indexed binding points.

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

Additional errors may be generated if offset​ violates any target​-specific alignmemt restrictions.

See Also

glBindBuffersRange, glGenBuffers, glDeleteBuffers, glIsBuffer, glBindBuffer, glBindBufferBase, glMapBufferRange, glUnmapBuffer,

Copyright

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