openGL之API学习(一一零)glProgramUniform

设置着色器程序中的一致变量的值。具体包含一系列函数:

void glProgramUniform1f(     GLuint program,
      GLint location,
      GLfloat v0);
 
void glProgramUniform2f(     GLuint program,
      GLint location,
      GLfloat v0,
      GLfloat v1);
 
void glProgramUniform3f(     GLuint program,
      GLint location,
      GLfloat v0,
      GLfloat v1,
      GLfloat v2);
 
void glProgramUniform4f(     GLuint program,
      GLint location,
      GLfloat v0,
      GLfloat v1,
      GLfloat v2,
      GLfloat v3);
 
void glProgramUniform1i(     GLuint program,
      GLint location,
      GLint v0);
 
void glProgramUniform2i(     GLuint program,
      GLint location,
      GLint v0,
      GLint v1);
 
void glProgramUniform3i(     GLuint program,
      GLint location,
      GLint v0,
      GLint v1,
      GLint v2);
 
void glProgramUniform4i(     GLuint program,
      GLint location,
      GLint v0,
      GLint v1,
      GLint v2,
      GLint v3);
 
void glProgramUniform1ui(     GLuint program,
      GLint location,
      GLuint v0);
 
void glProgramUniform2ui(     GLuint program,
      GLint location,
      GLint v0,
      GLuint v1);
 
void glProgramUniform3ui(     GLuint program,
      GLint location,
      GLint v0,
      GLint v1,
      GLuint v2);
 
void glProgramUniform4ui(     GLuint program,
      GLint location,
      GLint v0,
      GLint v1,
      GLint v2,
      GLuint v3);
 
void glProgramUniform1fv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLfloat *value);
 
void glProgramUniform2fv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLfloat *value);
 
void glProgramUniform3fv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLfloat *value);
 
void glProgramUniform4fv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLfloat *value);
 
void glProgramUniform1iv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLint *value);
 
void glProgramUniform2iv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLint *value);
 
void glProgramUniform3iv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLint *value);
 
void glProgramUniform4iv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLint *value);
 
void glProgramUniform1uiv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLuint *value);
 
void glProgramUniform2uiv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLuint *value);
 
void glProgramUniform3uiv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLuint *value);
 
void glProgramUniform4uiv(     GLuint program,
      GLint location,
      GLsizei count,
      const GLuint *value);
 
void glProgramUniformMatrix2fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix3fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix4fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix2x3fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix3x2fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix2x4fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix4x2fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix3x4fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);
 
void glProgramUniformMatrix4x3fv(     GLuint program,
      GLint location,
      GLsizei count,
      GLboolean transpose,
      const GLfloat *value);

program

    Specifies the handle of the program containing the uniform variable to be modified.

着色器程序标识符
location

    Specifies the location of the uniform variable to be modified.

一致变量在着色器程序中的位置
count

    For the vector commands (glProgramUniform*v), specifies the number of elements that are to be modified. This should be 1 if the targeted uniform variable is not an array, and 1 or more if it is an array.

对于数组型一致变量,指定变量中要修改的元素个数,如果一致变量不是数组该值为1,如果是数组则为实际要修改的数组元素个数(不应超过数组大小)。

    For the matrix commands (glProgramUniformMatrix*), specifies the number of matrices that are to be modified. This should be 1 if the targeted uniform variable is not an array of matrices, and 1 or more if it is an array of matrices.

对于矩阵型一致变量,指定变量中要修改的元素个数,如果一致变量不是矩阵数组该值为1,如果是矩阵数组则为实际要修改的数组元素个数(不应超过数组大小)。
transpose

    For the matrix commands, specifies whether to transpose the matrix as the values are loaded into the uniform variable.

是否对矩阵进行转置,默认(GL_FALSE)不转置,以列为主序,GL_TRUE为转置,以行为主序。
v0, v1, v2, v3

    For the scalar commands, specifies the new values to be used for the specified uniform variable.

具体数值
value

    For the vector and matrix commands, specifies a pointer to an array of count values that will be used to update the specified uniform variable.

具体数值数组,针对数组、矩阵型一致变量

 

 

 

 

 

 

 

 


版权声明:本文为hankern原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。