傳入繪制資訊
======================
OpenGL ES 2.0API的作用分類:
用于從手機擷取繪制buffer
用于溝通GPU可程式設計子產品
用于傳入繪制資訊
用于設定繪制狀态
用于執行繪制指令
用于查詢環境、清理狀态
1.
void glGenBuffers(GLsizei n, GLuint *buffers);
功能:建立若幹個buffer object name
輸入:數字n用于指定建立buffer的數量,指針用于儲存這組buffer的變量名
2.
void glBindBuffer(GLenum target, GLuint buffer);
功能:将某個特定的buffer用于儲存某個特定target的資訊
輸入:某個特定的target,特定buffer的ID
3.
void glBufferData(GLenum target, GLsizeptr size, const GLvoid* data, GLenum usage);
功能:通過指定一個特定的target,往target對應的buffer傳入一定長度的資料,并且指定該buffer未來被使用的頻率
輸入:某個特定target,一定長度的資料,該buffer的使用方式
4.
void glBufferSubData(GLenum target, GLintptr offset, GLsizeptr size, const GLvoid* data);
功能:通過指定一個特定的target, 往target對應buffer的第offset位開始,傳入一定長度的資料
輸入:某個特定的target,buffer的第offset位,一定長度的資料
5.
void glDeleteBuffers(GLsizei n, const GLuint* buffers);
功能:删除指定的buffer object
輸入:數字n用于指定要删除的buffer的數量,指針用于儲存這組buffer的變量名
6.
void glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
功能:用于将指定program中的某個attribute,與某個固定的index進行綁定,在OpenGL ES中就可以通過該index對此attribute進行通路
輸入:指定的program的ID,一個index常量,program綁定的VS中某個attribute的變量名字元串
7.
GLint glGetAttribLocation(GLuint program, const GLchar* name)
功能:擷取指定program中的某個attribute的index,在OpenGL ES中就可以通過該index對此attribute進行通路
輸入:指定program的ID,program綁定的VS中某個attribute的變量名字元串
輸出:一個index常量
8.
void glEnableVertexAttribArray(GLuint index)
功能:将指定program中的某個attribute的開關打開,打開後,在OpenGL ES中就可以通過該index對此attribute進行通路,且在繪制的時候,Shader就可以通路到attribute對應的值
輸入:指定program中的某個attribute的index
9.
void glDisableVertexAttribArray(GLuint index)
功能:将指定program中的某個attribute的開關關閉,關閉後,在繪制的時候,Shader将無法通路到attribute對應的值
輸入:指定program中的某個attribute的index
10.
void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* pointer)
功能:往attribute傳入一定數量、某種格式、特定間隔的資料,并指明傳入之後,是否需要對這些資料進行歸一化
輸入:attribute的index,資料的尺寸、類型、是否歸一化、間隔和資料本身,如果使用BO的話,那麼不需要傳入資料的本身,而傳入資料在BO中的偏移量
11.
void glVertexAttrib*f(GLuint index, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
功能:給指定program中的某個attribute進行指派,可以在該函數中傳入一到四個成員的值
輸入:指定program中的某個attribute的index,用于指派的值