glCopyBufferSubData — copy part of the data store of a buffer object to the data store of another buffer object
void glCopyBufferSubData(
|
GLenum readtarget, |
GLenum writetarget, | |
GLintptr readoffset, | |
GLintptr writeoffset, | |
GLsizeiptr size) ; |
readtarget
Specifies the target from whose data store data should be read.
writetarget
Specifies the target to whose data store data should be written.
readoffset
Specifies the offset, in basic machine units, within the data store of readtarget
from which data should be read.
writeoffset
Specifies the offset, in basic machine units, within the data store of writetarget
to which data should be written.
size
Specifies the size, in basic machine units, of the data to be copied from readtarget
to writetarget
.
glCopyBufferSubData
copies part of the data store attached to readtarget
to the
data store attached to writetarget
. The number of basic machine units indicated by size
is copied from the source, at offset readoffset
to the destination at writeoffset
,
also in basic machine units.
readTarget
and
writeTarget
specify the targets to which
the source and destination buffer objects are bound, and must
each be one of the buffer binding targets in the following
table:
Buffer Binding Target | Purpose |
---|---|
GL_ARRAY_BUFFER
|
Vertex attributes |
GL_ATOMIC_COUNTER_BUFFER
|
Atomic counter storage |
GL_COPY_READ_BUFFER
|
Buffer copy source |
GL_COPY_WRITE_BUFFER
|
Buffer copy destination |
GL_DISPATCH_INDIRECT_BUFFER
|
Indirect compute dispatch commands |
GL_DRAW_INDIRECT_BUFFER
|
Indirect command arguments |
GL_ELEMENT_ARRAY_BUFFER
|
Vertex array indices |
GL_PIXEL_PACK_BUFFER
|
Pixel read target |
GL_PIXEL_UNPACK_BUFFER
|
Texture data source |
GL_SHADER_STORAGE_BUFFER
|
Read-write storage for shaders |
GL_TEXTURE_BUFFER
|
Texture data buffer |
GL_TRANSFORM_FEEDBACK_BUFFER
|
Transform feedback buffer |
GL_UNIFORM_BUFFER
|
Uniform block storage |
Any of these targets may be used, but the targets
GL_COPY_READ_BUFFER
and
GL_COPY_WRITE_BUFFER
are provided
specifically to allow copies between buffers without disturbing
other GL state.
readoffset
, writeoffset
and size
must all be greater than or equal to
zero. Furthermore, readoffset
+ size
must not exceeed the size of the buffer
object bound to readtarget
, and writeoffset
+ size
must not exceeed the
size of the buffer bound to writetarget
. If the same buffer object is bound to both readtarget
and writetarget
, then the ranges specified by readoffset
, writeoffset
and size
must not overlap.
GL_INVALID_VALUE
is generated if any of readoffset
, writeoffset
or size
is negative, if readoffset
+ size
exceeds the
size of the buffer object bound to readtarget
or if writeoffset
+ size
exceeds the size of the buffer object bound to writetarget
.
GL_INVALID_VALUE
is generated if the same buffer object is bound to both readtarget
and writetarget
and the ranges [readoffset
, readoffset
+
size
) and [writeoffset
, writeoffset
+ size
)
overlap.
GL_INVALID_OPERATION
is generated if zero is bound to readtarget
or writetarget
.
GL_INVALID_OPERATION
is generated if the buffer object bound to either readtarget
or writetarget
is mapped.
OpenGL ES API Version | ||||
---|---|---|---|---|
Function Name | 2.0 | 3.0 | 3.1 | 3.2 |
glCopyBufferSubData | - | ✔ | ✔ | ✔ |
Copyright © 2010-2015 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. https://opencontent.org/openpub/.