从顶点属性(位置、纹理、颜色、法线)序号获取着色器中顶点属性的名称、类型等信息。顶点属性序号可通过glGetProgram GL_ACTIVE_ATTRIBUTES来获取。如果在链接操作期间确定属性变量可以在程序执行期间被访问,则该属性变量被认为是活动的,如gl_Vertex、gl_Normal等。
void glGetActiveAttrib( GLuint program,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint *size,
GLenum *type,
GLchar *name);
program
Specifies the program object to be queried.
指定着色器程序标识符。
index
Specifies the index of the attribute variable to be queried.
指定顶点属性的索引序号。
bufSize
Specifies the maximum number of characters OpenGL is allowed to write in the character buffer indicated by name.
指定顶点属性名称字符串的最大长度。
length
Returns the number of characters actually written by OpenGL in the

本文介绍OpenGL中的glGetActiveAttrib函数,用于获取着色器程序中顶点属性的名称、类型等信息。通过该函数,可以查询到顶点属性变量的索引、大小、数据类型和名称,帮助理解并使用OpenGL着色器。
glGetActiveAttrib&spm=1001.2101.3001.5002&articleId=95106980&d=1&t=3&u=f0446eb15f304b04b75e5e38ca9951a7)
361

被折叠的 条评论
为什么被折叠?



