opengl相关函数

void glGenBuffers( GLsizei n, GLuint * buffers)

产生buffers名称

变量意义
n生成buffers的个数
buffers生成n个buffers的name

void glBindBuffer( GLenum target, GLuint buffer)

设定buffer的类别

变量意义
target绑定的buffer类别
buffer绑定的buffer
target类别解释
GL_ARRAY_BUFFERVertex attributes
GL_ATOMIC_COUNTER_BUFFERAtomic counter storage
GL_COPY_READ_BUFFERBuffer copy source
GL_COPY_WRITE_BUFFERBuffer copy destination
GL_DISPATCH_INDIRECT_BUFFERIndirect compute dispatch commands
GL_DRAW_INDIRECT_BUFFERIndirect command arguments
GL_ELEMENT_ARRAY_BUFFERVertex array indices
GL_PIXEL_PACK_BUFFERPixel read target
GL_PIXEL_UNPACK_BUFFERTexture data source
GL_QUERY_BUFFERQuery result buffer
GL_SHADER_STORAGE_BUFFERRead-write storage for shaders
GL_TEXTURE_BUFFERTexture data buffer
GL_TRANSFORM_FEEDBACK_BUFFERTransform feedback buffer
GL_UNIFORM_BUFFERUniform block storage

void glBufferData( GLenum target,GLsizeiptr size,const GLvoid * data,GLenum usage)

创建并初始化buffer的存储空间

变量意义
target制定绑定对象的类型,解释见上
size数据所需空间大小
data初始化buffer的数据,没有为空
usage指定buffer的预期使用模式,可能会影响对buffer使用的性能,主要表现在频率和性能,常用的有: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
usage意义
STREAMThe data store contents will be modified once and used at most a few times.
STATICThe data store contents will be modified once and used many times.
DYNAMICThe data store contents will be modified repeatedly and used many times.
DRAWThe data store contents are modified by the application, and used as the source for GL drawing and image specification commands.
READThe data store contents are modified by reading data from the GL, and used to return that data when queried by the application.
COPYThe data store contents are modified by reading data from the GL, and used as the source for GL drawing and image specification commands.

void glDeleteBuffers( GLsizei n,const GLuint * buffers)

删除buffers

变量意义
n生成buffers的个数
buffers生成n个buffers的name

参考链接:https://www.khronos.org/registry/OpenGL-Refpages/gl4/

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页