GLBUFFERSUBDATA(3G)
π
GLBUFFERSUBDATA β the 3G manual page, bestie β¨
okay so this is GLBUFFERSUBDATA(3G), and the header literally has a [FIXME: manual] placeholder in it β unfinished draft energy, but we move. This page is all about updating just a little slice of a buffer object's data store, and the main characters are glBufferSubData and glNamedBufferSubData. Let's go π
πΈ NAME πΈ
glBufferSubData, glNamedBufferSubData β updates a subset of a buffer object's data store
π§ C SPECIFICATION π§
void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size,
const GLvoid * data);
void glNamedBufferSubData(GLuint buffer, GLintptr offset,
GLsizeiptr size, const void *data);
β¨ PARAMETERS β¨
targetβ specifies the target to which the buffer object is bound forglBufferSubData, which must be one of the buffer binding targets in the following table:GL_ARRAY_BUFFERβ vertex attributesGL_ATOMIC_COUNTER_BUFFERβ atomic counter storageGL_COPY_READ_BUFFERβ buffer copy sourceGL_COPY_WRITE_BUFFERβ buffer copy destinationGL_DISPATCH_INDIRECT_BUFFERβ indirect compute dispatch commandsGL_DRAW_INDIRECT_BUFFERβ indirect command argumentsGL_ELEMENT_ARRAY_BUFFERβ vertex array indicesGL_PIXEL_PACK_BUFFERβ pixel read targetGL_PIXEL_UNPACK_BUFFERβ texture data sourceGL_QUERY_BUFFERβ query result bufferGL_SHADER_STORAGE_BUFFERβ read-write storage for shadersGL_TEXTURE_BUFFERβ texture data bufferGL_TRANSFORM_FEEDBACK_BUFFERβ transform feedback bufferGL_UNIFORM_BUFFERβ uniform block storage
bufferβ specifies the name of the buffer object forglNamedBufferSubData.offsetβ specifies the offset into the buffer object's data store where data replacement will begin, measured in bytes.sizeβ specifies the size in bytes of the data store region being replaced.dataβ specifies a pointer to the new data that will be copied into the data store.
π¦ DESCRIPTION π¦
glBufferSubData and glNamedBufferSubData redefine some or all of the data store for the specified buffer object. Data starting at byte offset and extending for size bytes is copied to the data store from the memory pointed to by data. offset and size must define a range lying entirely within the buffer object's data store.
π NOTES π
When replacing the entire data store, consider using glBufferSubData rather than completely recreating the data store with glBufferData. This avoids the cost of reallocating the data store.
Consider using multiple buffer objects to avoid stalling the rendering pipeline during data store updates. If any rendering in the pipeline makes reference to data in the buffer object being updated by glBufferSubData, especially from the specific region being updated, that rendering must drain from the pipeline before the data store can be updated.
Clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N bytes be a multiple of N.
The GL_ATOMIC_COUNTER_BUFFER target is available only if the GL version is 4.2 or greater.
The GL_DISPATCH_INDIRECT_BUFFER and GL_SHADER_STORAGE_BUFFER targets are available only if the GL version is 4.3 or greater.
The GL_QUERY_BUFFER target is available only if the GL version is 4.4 or greater.
π ERRORS π
GL_INVALID_ENUMis generated byglBufferSubDataiftargetis not one of the accepted buffer targets.GL_INVALID_OPERATIONis generated byglBufferSubDataif zero is bound totarget.GL_INVALID_OPERATIONis generated byglNamedBufferSubDataifbufferis not the name of an existing buffer object.GL_INVALID_VALUEis generated ifoffsetorsizeis negative, or if offset + size is greater than the value ofGL_BUFFER_SIZEfor the specified buffer object.GL_INVALID_OPERATIONis generated if any part of the specified range of the buffer object is mapped withglMapBufferRange()orglMapBuffer(), unless it was mapped with theGL_MAP_PERSISTENT_BITbit set in theglMapBufferRangeaccess flags.GL_INVALID_OPERATIONis generated if the value of theGL_BUFFER_IMMUTABLE_STORAGEflag of the buffer object isGL_TRUEand the value ofGL_BUFFER_STORAGE_FLAGSfor the buffer object does not have theGL_DYNAMIC_STORAGE_BITbit set.
π ASSOCIATED GETS π
glGetBufferSubData()
π VERSION SUPPORT π
The version-support table has Function / Feature Name on one side and OpenGL Version across the top. Here's the whole vibe check:
glBufferSubDataβ supported (β) in OpenGL2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4, and4.5.glNamedBufferSubDataβ not supported (-) in OpenGL2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3, and4.4; supported (β) only in4.5.
π₯ SEE ALSO π₯
glBindBuffer(), glBufferData(), glMapBuffer(), glMapBufferRange(), glUnmapBuffer()
π COPYRIGHT π
Copyright Β© 2005 Addison-Wesley. Copyright Β© 2010-2014 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/.
π COPYRIGHT π
Copyright Β© 2005 Sams Publishing Copyright Β© 2010-2014 Khronos Group
okay bye bestie β this page is from [FIXME: source], dated 08/09/2021, and it's literally the GLBUFFERSUBDATA(3G) manual page ππ«Ά
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms