Home opengl - glBufferData
Post
Cancel

opengl - glBufferData

doc

Name

glBufferData, glNamedBufferData — creates and initializes a buffer object’s data store

C Specification

1
2
3
4
5
6
7
8
9
void glBufferData(	GLenum target,
 	GLsizeiptr size,
 	const void * data,
 	GLenum usage);
 
void glNamedBufferData(	GLuint buffer,
 	GLsizeiptr size,
 	const void *data,
 	GLenum usage);

Parameters

target

Specifies the target to which the buffer object is bound for glBufferData, which must 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_QUERY_BUFFER Query result buffer
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

buffer

Specifies the name of the buffer object for glNamedBufferData function.

size

Specifies the size in bytes of the buffer object’s new data store.

data

Specifies a pointer to data that will be copied into the data store for initialization, or NULL if no data is to be copied.

usage

Specifies the expected usage pattern of the data store. The symbolic constant must be GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.

Description

glBufferData and glNamedBufferData create a new data store for a buffer object. In case of glBufferData, the buffer object currently bound to target is used. For glNamedBufferData, a buffer object associated with ID specified by the caller in buffer will be used instead.

This post is licensed under CC BY 4.0 by the author.