OpenGL ES3.0 《学习笔记 六》 Vertex Attributes, Vertex Arrays, and Buffer Objects

Vertex attributes

所有 OpenGL ES 3.0 的实现必须至少支持16个vertex attribute,实际支持的个数可以通过GL_MAX_VERTEX_ATTRIBS查询
GLint maxVertexAttribs; // n will be >= 16 
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs);


Constant Vertex Attribute

void glVertexAttriblf(GLuint index, GLfloat x);
void glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
void glVertexAttrib3f( GLuint index, GLfloat x, GLfloat y, GLfloat z);
void glVertexAttrib4f( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void glVertexAttriblfv(GLuint index, const GLfloat *values);
void glVertexAttrib2fv(GLuint index, const GLfloat *values);
void glVertexAttrib3fv(GLuint index, const GLfloat *values);
void glVertexAttrib4fv(GLuint index, const GLfloat *values);


The glVertexAttrib*commands are used to load the generic vertex attribute specified by index.

其中

(1)glVertexAttriblf 和 glVertexAttriblfv     加载  (x, 0.0, 0.0, 1.0)

(2)glVertexAttrib2f 和 glVertexAttrib2fv   加载  (x, y, 0.0, 1.0)

(3)glVertexAttrib3f 和 glVertexAttrib3fv   加载  (x, y, z, 1.0)

(4)glVertexAttrib4f 和 glVertexAttribl4fv  加载  (x, y, z, w)

一般来说使用Constant Vertex Attribute类似于使用a scalar/vector uniform

index应该指明的是什么属性


Vertex arrays 

使用glVertexAttribPointer 或者 glVertexAttribIPointer

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值