API翻译:glBindBuffer

本文介绍了OpenGL函数glBindBuffer的使用方法及其参数含义。通过绑定不同的目标类型,如顶点数组缓冲、元素数组缓冲等,可以有效地管理和操作客户端内存中的数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Name

glBindBuffer
绑定一个已命名的buffer object

C Specification

void glBindBuffer( GLenum target,
GLuint buffer);

Parameters

target
指定buffer object绑定的target。这个必须是 GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, or GL_PIXEL_UNPACK_BUFFER.

buffer
Specifies the name of a buffer object.

Description

1.glBindBuffer让你创建或使用一个已命名的buffer object。Calling glBindBuffer with target set to GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER or GL_PIXEL_UNPACK_BUFFER and buffer set to the name of the new buffer object binds the buffer object name to the target.当一个buffer object绑定了一个target,之前target的绑定将会自动失效。

2.Buffer object names 是正整数。0值被保留,但对于target没有默认的buffer object。取而代之的是,将buffer设为0可以高效的取消buffer object之前的绑定,并还原这个buffer object target的client内存。Buffer object names 和对应的buffer object contents是存放在当前GL rendering context的共享显示列表空间中(shared display-list space )(see glXCreateContext) ;只有当两个rendering contexts共享了display lists,他们才共享buffer object names。

3.你可以使用glGenBuffers来生成一系列新的buffer object names。

4.一个buffer object在第一次被绑定时,它立即拥有对一块尚未被映射,0大小的内存GL_READ_WRITE的访问权限和GL_STATIC_DRAW usage(使用权限?)。

5.当一个非零 buffer object name被绑定,GL对绑定的target的操作将影响被绑定的buffer object,且查询绑定的taget从buffer object的返回状态。当为0的buffer object name被绑定时,当企图修改或查询target的状态时,将生成一个GL_INVALID_OPERATION错误。

6.当一个 vertex array pointer(顶点数组指针)的状态被改变,例如 调用glNormalPointer,当前buffer object正在绑定(GL_ARRAY_BUFFER_BINDING)这个状态将被拷贝到vertex array的client state中?当 一个非零buffer object绑定到GL_ARRAY_BUFFER target中,这个传统上被解释为指向客户端内存的顶点数组pointer参数,将被重新解释为一个buffer object的偏移量,它以basic machine units为单位衡量。(While a non-zero buffer object is bound to the GL_ARRAY_BUFFER target, the vertex array pointer parameter that is traditionally interpreted as a pointer to client-side memory is instead interpreted as an offset within the buffer object measured in basic machine units.)

7.While a non-zero buffer object is bound to the GL_ELEMENT_ARRAY_BUFFER target, the indices parameter of glDrawElements, glDrawRangeElements, or glMultiDrawElements that is traditionally interpreted as a pointer to client-side memory is instead interpreted as an offset within the buffer object measured in basic machine units.

While a non-zero buffer object is bound to the GL_PIXEL_PACK_BUFFER target, the following commands are affected: glGetCompressedTexImage, glGetConvolutionFilter, glGetHistogram, glGetMinmax, glGetPixelMap, glGetPolygonStipple, glGetSeparableFilter, glGetTexImage, and glReadPixels. The pointer parameter that is traditionally interpreted as a pointer to client-side memory where the pixels are to be packed is instead interpreted as an offset within the buffer object measured in basic machine units.

While a non-zero buffer object is bound to the GL_PIXEL_UNPACK_BUFFER target, the following commands are affected: glBitmap, glColorSubTable, glColorTable, glCompressedTexImage1D, glCompressedTexImage2D, glCompressedTexImage3D, glCompressedTexSubImage1D, glCompressedTexSubImage2D, glCompressedTexSubImage3D, glConvolutionFilter1D, glConvolutionFilter2D, glDrawPixels, glPixelMap, glPolygonStipple, glSeparableFilter2D, glTexImage1D, glTexImage2D, glTexImage3D, glTexSubImage1D, glTexSubImage2D, and glTexSubImage3D. The pointer parameter that is traditionally interpreted as a pointer to client-side memory from which the pixels are to be unpacked is instead interpreted as an offset within the buffer object measured in basic machine units.

8.一个被glBindBuffer创建的buffer object binding一直保持激活状态,直到另一个buffer object name被绑定到相同的target上,或者这个绑定的buffer object被glDeleteBuffers删除了。

9.一旦被创建,a named buffer object可有被重新绑定到任何target上。然而,GL的实现可能会选择如何优化a buffer object的存储。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值