GLES2.0中文API-glGetAttribLocation

名称

glGetAttribLocation - 返回属性变量的位置

C规范

GLint glGetAttribLocation(GLuint program,const GLchar *name);

参数

program

指定要查询的程序对象。

name

要查询其位置的属性变量的名称。

描述

glGetAttribLocation查询由program指定的先前链接的程序对象,用于name指定的属性变量,并返回绑定到该属性变量的通用顶点属性的索引。 如果name是矩阵属性变量,则返回矩阵的第一列的索引。 如果指定的属性变量不是指定程序对象中的活动属性,或者名称以保留前缀“gl_”开头,则返回-1。

可以通过调用glBindAttribLocation随时指定属性变量名和通用属性索引之间的关联。 在调用glLinkProgram之前,属性绑定不会生效。 成功链接程序对象后,属性变量的索引值将保持固定,直到发生下一个链接命令。 如果链接成功,则只能在链接后查询属性值。 glGetAttribLocation返回上次为指定程序对象调用glLinkProgram时实际生效的绑定。 glGetAttribLocation不返回自上次链接操作以来指定的属性绑定。

错误

GL_INVALID_OPERATION program不是OpenGL生成的值。

GL_INVALID_OPERATION program不是程序对象。

GL_INVALID_OPERATION program没有成功链接。

相关Gets

glGetActiveAttrib 参数program和活动的属性索引。

glIsProgram

另见

glBindAttribLocationglLinkProgramglVertexAttribglVertexAttribPointer​​​​​​​

版权

https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glGetAttribLocation.xml

https://blog.csdn.net/flycatdeng

Copyright © 1991-2006 Silicon Graphics, Inc.本文档的许可是根据SGI Free Software B License.详见http://oss.sgi.com/projects/FreeB/.

Android,OpenGL ES,图形学

猜你喜欢

转载自blog.csdn.net/dengchukun/article/details/82667174