1.
<pre lang="c">
void glAttachShader(GLuint program, GLuint shader)
program handle to the program object
shader handle to the shader object to attach to the program
</pre>
调用glattachshader时,shader可以还没有编译,甚至可以还没有绑定源码。
2,可以通过调用glGetProgramiv,获得当前已经使用的uniform变量个数,以及系统支持的uniform变量最大字符数,包括结尾的null字符。
3,有一打的函数用于载入uniform变量的值,像
<pre lang="c">
void glUniform4i(GLint location, GLint x, GLint y,
GLint z, GLint w)
void glUniform4iv(GLint location, GLsizei count,
const GLint* v)
</pre>
如果是向量版本,参数count指示有多少值需要传过去,非数组型的uniform变量,传1,数组型变量,传glGetActiveUniform函数得到的SIZE值。glUniform*函数无需带program指针参数,它作用于当前活动的program。变量值一量设下去,如果你激活另一个program,原来program中uniform的变量值 仍然有效。
2011-04-17