API翻译:glVertexAttribPointer

Name

glVertexAttribPointer
定义一个顶点属性数据的数组。

C Specification
void glVertexAttribPointer( GLuint index,
    GLint size,
    GLenum type,
    GLboolean normalized,
    GLsizei stride,
    const GLvoid * pointer);
Parameters

index
指定将要被改变的generic vertex attribute的索引。

size
指定每个顶点属性由多少个数组成。必须是1,2,3或4.默认值为4.

type
指定数组中每个component的数据类型。包括GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_FIXED, or GL_FLOAT are accepted. The initial value is GL_FLOAT.

normalized
指定在访问时,定点数据值是否被规格化(GL_TRUE)或者直接作为定点数据传递(GL_FALSE)。

stride
指定两个连续顶点属性的字节偏移量。如果stride is 0, 这个generic vertex attributes 被认为在数组中是仅仅挨着的(the generic vertex attributes are understood to be tightly packed in the array)。初始值是0.

pointer
指定一个指向数组第一个generic vertex attribute的第一个component的指针。默认为0.

Description

glVertexAttribPointer定义了渲染时generic vertex attributes中索引为index的数组的位置和数据格式。size定义了每个属性的components的个数,必须是1, 2, 3, or 4。type定义了每个component的类型,stride定义了从一个属性到下一个的字节的跨度,这样顶点和属性就可以一起保存在一个单一的数组或者分开保存到多个数组。如果设置GL_TRUE,规格化意味着当你访问的时候,一个保存格式为integer 的数将被映射为范围为[-1,1](for signed values) or [0,1] (for unsigned values)的浮点数。Otherwise, values will be converted to floats directly without normalization.

如果一个非零的named buffer object被绑定到GL_ARRAY_BUFFER target,当一个 a generic vertex attribute array被定义了,pointer被当做是这个buffer object的数据存储的偏移量。并且,the buffer object binding (GL_ARRAY_BUFFER_BINDING) is saved as generic vertex attribute array client-side state (GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) for index index.

When a generic vertex attribute array is specified, size, type, normalized, stride, and pointer are saved as client-side state, in addition to the current vertex array buffer object binding.

To enable and disable a generic vertex attribute array, call glEnableVertexAttribArray and glDisableVertexAttribArray with index. If enabled, the generic vertex attribute array is used when glDrawArrays or glDrawElements is called.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值