Shader Object及Program操作API

Program: 
1。 GLuint glCreateProgram( void );//创建

2。 void glDeleteProgram( GLuint program );//销毁

3。 void glGetProgramiv(
GLuint program,
GLenum pname,
GLint *params
); //获取参数

4。void glGetProgramInfoLog(
GLuint program,
GLsizei maxLength,
GLsizei *length,
GLchar *infoLog
);//获取Log信息,Log信息在program链接或确认时会更新

5。void glLinkProgram(
GLuint program
);//链接

6。void glValidateProgram(
GLuint program
);//确认,通常只在开发时时有用

7。GLboolean glIsProgram(
GLuint program
);//判断是否是program object

8。void glUseProgram(
GLuint program
);//将program安装到当前状态中

9。void glGetAttachedShaders(
GLuint program,
GLsizei maxCount,
GLsizei *count,
GLuint *shaders
);//获取附加的shader列表

Shader:
1。GLuint glCreateShader(
GLenum shaderType
);//创建

2。void glDeleteShader(
GLuint shader
);//销毁

3。void glShaderSource(
GLuint shader,
GLsizei count,
const GLchar **string,
const GLint *length
);//为shader填充/替换源码,源码可由多个字符串组成

4。void glCompileShader(
GLuint shader
);//编译

5。void glGetShaderiv(
GLuint shader,
GLenum pname,
GLint *params
);//获取参数

6。void glGetShaderInfoLog(
GLuint shader,
GLsizei maxLength,
GLsizei *length,
GLchar *infoLog
);//获取Log信息,只在编译后更新

7。void glGetShaderSource(
GLuint shader,
GLsizei bufSize,
GLsizei *length,
GLchar *source
);//获取源码,源码长度可以先用glGetShader(GL_SHADER_SOURCE_LENGTH)获取

8。GLboolean glIsShader(
GLuint shader
);//判断是否是shader object

9。void glAttachShader(
GLuint program,
GLuint shader
);//将一个shader附加到program

10。void glDetachShader(
GLuint program,
GLuint shader
);//将shader从program中去除

Uniform参数
1。GLint glGetUniformLocation(
GLuint program,
const GLchar *name
); //获取Uniform变量的位置,它在编译后决定

2。glUniform{1|2|3|4}{f|i}, glUniformMatrix{2|3|4}fv ,glUniform{1|2|3|4}{f|i}v
//设置Uniform变量值

3。void glGetUniform{f|i}v(
GLuint program,
GLint location,
GLint *params
);//获取uniform当前值

4。void glGetActiveUniform(
GLuint program,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint *size,
GLenum *type,
GLchar *name
);//获取uniform变量熟悉

Attribute变量
1。void glBindAttribLocation(
GLuint program,
GLuint index,
const GLchar *name
);//绑定一个自定义属性变量位置

2。void glGetActiveAttrib(
GLuint program,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint *size,
GLenum *type,
GLchar *name
);//获取属性变量属性

3。GLint glGetAttribLocation(
GLuint program,
const GLchar *name
);//获取熟悉变量位置

4。glVertexAttrib
//设置一个属性变量的值

5。glVertexAttribPointer 
//设置一个属性变量数组

6。glGetVertexAttribdv, glGetVertexAttribfv, glGetVertexAttribiv
//获取一个属性变量值

7。glGetVertexAttribPointer
//获取一个属性数组

8。void glEnableVertexAttribArray(
GLuint index
);//使能一个属性数组

9。void glDisableVertexAttribArray(
GLuint index
);//禁用一个属性数组