logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

glGetBufferParameteriv, glGetBufferParameteri64v, glGetNamedBufferParameteriv,

C Specification

voidglGetBufferParameteriv(GLenumtarget,GLenumvalue,GLint*data);voidglGetBufferParameteri64v(GLenumtarget,GLenumvalue,GLint64*data);voidglGetNamedBufferParameteriv(GLuintbuffer,GLenumpname,GLint*params);voidglGetNamedBufferParameteri64v(GLuintbuffer,GLenumpname,GLint64*params);

Description

       These functions return in data a selected parameter of the specified buffer object.

       pname names a specific buffer object parameter, as follows:

       GL_BUFFER_ACCESSparams returns the access policy set while mapping the buffer object (the value of the access
           parameter enum passed to glMapBuffer). If the buffer was mapped with glMapBufferRange, the access
           policy is determined by translating the bits in that access parameter to one of the supported enums
           for glMapBuffer as described in the OpenGL Specification.

       GL_BUFFER_ACCESS_FLAGSparams returns the access policy set while mapping the buffer object (the value of the access
           parameter bitfield passed to glMapBufferRange). If the buffer was mapped with glMapBuffer, the access
           policy is determined by translating the enums in that access parameter to the corresponding bits for
           glMapBufferRange as described in the OpenGL Specification. The initial value is zero.

       GL_BUFFER_IMMUTABLE_STORAGEparams returns a boolean flag indicating whether the buffer object is immutable. The initial value is
           GL_FALSE.

       GL_BUFFER_MAPPEDparams returns a flag indicating whether the buffer object is currently mapped. The initial value is
           GL_FALSE.

       GL_BUFFER_MAP_LENGTHparams returns the length of the mapping into the buffer object established with glMapBuffer*. The
           i64v versions of these queries should be used for this parameter. The initial value is zero.

       GL_BUFFER_MAP_OFFSETparams returns the offset of the mapping into the buffer object established with glMapBuffer*. The
           i64v versions of these queries should be used for this parameter. The initial value is zero.

       GL_BUFFER_SIZEparams returns the size of the buffer object, measured in bytes. The initial value is 0.

       GL_BUFFER_STORAGE_FLAGSparams returns a bitfield indicating the storage flags for the buffer object. If the buffer object is
           immutable, the value returned will be that specified when the data store was established with
           glBufferStorage. If the data store was established with glBufferData, the value will be
           GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_DYNAMIC_STORAGE_BIT | GL_MAP_WRITE_BIT. The initial value is
           zero.

       GL_BUFFER_USAGEparams returns the buffer object's usage pattern. The initial value is GL_STATIC_DRAW.

Errors

GL_INVALID_ENUM is generated by glGetBufferParameter* if target is not one of the accepted buffer
       targets.

       GL_INVALID_OPERATION is generated by glGetBufferParameter* if zero is bound to target.

       GL_INVALID_OPERATION is generated by glGetNamedBufferParameter* if buffer is not the name of an existing
       buffer object.

       GL_INVALID_ENUM is generated if pname is not one of the buffer object parameter names described above.

Name

       glGetBufferParameteriv, glGetBufferParameteri64v, glGetNamedBufferParameteriv,
       glGetNamedBufferParameteri64v - return parameters of a buffer object

Notes

       If an error is generated, no change is made to the contents of data.

       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.

Parameters

target
           Specifies the target to which the buffer object is bound for glGetBufferParameteriv and
           glGetBufferParameteri64v. Must be one of the buffer binding targets in the following table:
           ┌──────────────────────────────┬────────────────────────────────────┐
           │ BufferBindingTargetPurpose                            │
           ├──────────────────────────────┼────────────────────────────────────┤
           │ 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 glGetNamedBufferParameteriv and
           glGetNamedBufferParameteri64v.

       value
           Specifies the name of the buffer object parameter to query.

       data
           Returns the requested parameter.

See Also

glBindBuffer(), glBufferData(), glGetBufferPointerv(), glMapBuffer(), glUnmapBuffer()

Version Support

       ┌───────────────────────────────┬───────────────────────────────────────────────────────────────────────┐
       │                               │                OpenGLVersion                                         │
       ├───────────────────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
       │ Function2.02.13.03.13.23.34.04.14.24.34.44.5 │
       │ /                             │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Feature                       │     │     │     │     │     │     │     │     │     │     │     │     │
       │ Name                          │     │     │     │     │     │     │     │     │     │     │     │     │
       ├───────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGetBufferParameteri64v      │  -  │  -  │  -  │  -  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
       ├───────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGetBufferParameteriv        │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │  ✔  │
       ├───────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGetNamedBufferParameteri64v │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │
       ├───────────────────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
       │ glGetNamedBufferParameteriv   │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  -  │  ✔  │
       └───────────────────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘

See Also