Opengl4.5 中文手册—V
索引
V
glValidateProgram 2.0
验证程序是否可以正确执行,主要用于开发时调试
GLuint program
glGetProgramiv(program , GL_VALIDATE_STATUS, &ok) 可获取是否通过验证
glValidateProgramPipeline 4.1
验证管线状态
4.3顶点属性、顶点索引绑定新方法
glVertexAttribBinding 4.3
设置当前VAO, 关联顶点属性索引与顶点属性buffer索引
GLuint attribindex,
GLuint bindingindex
glVertexAttribFormat 4.3
设置当前VAO顶点属性类型信息
GLuint attribindex,
GLint size,
GLenum type,
GLboolean normalized,
GLuint relativeoffset
参数与通常的glVertexAttribPointer作用相同
glVertexBindingDivisor 4.3
设置当前VAO Divisor信息
glVertexArrayElementBuffer 4.5
设置VAO顶点索引缓冲区
GLuint vaobj,
GLuint buffer
glBindVertexBuffer 4.3
设置当前VAO,绑定顶点属性缓冲区
GLuint bindingindex,
GLuint buffer,
GLintptr offset,
GLintptr stride
glBindVertexBuffers 4.4
一次绑定多个buffer
glVertexAttrib 2.0
指定常量顶点属性,与uniform相同
通过glEnableVertexAttirbArray启用了顶点属性数组时,则使用顶点属性数组
glVertexAttribDivisor 3.2
设置实例绘制顶点属性信息(glDrawArraysInstanced、glDrawElementsInstanced)
GLuint index, 顶点属性索引
GLuint divisor 0表示普通顶点属性,大于0表示每divisor个实例使用同一个顶点属性
glVertexAttribPointer 2.0
指定顶点属性所有使用的VBO及其数据格式
2.0+
GLuint index 顶点属性索引(绑定点), shader中由layout(location=0)指定
GLint size成员个数1\2\3\4,或者RGBA表示4
GLenum type 成员类型,一般为GL_FLOAT
GLboolean normalized 是否需要normalized,一般GL_FALSE
GLsizei stride 跨距,0表示紧密排列,相当于size * sizeof(type)
const GLvoid* pointer 对应buffer偏移量:(const GLvoid *) offset; //只所以是void*是因为之前可以用直接用内存地址,不用vbo。3.3之后这里只能vbo, 这个参数作为偏移量使用
例:
glBindBuffer(GL_ARRAY_BUFFER, VBO1); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0); //属性0使用VBO1,数据格式为3个一组的浮点数 4.3版本之后可以使用glBindVertexBuffer直接设置顶点属性使用的缓冲区和格式。上面两句等价于: glBindVertexBuffer(0, VBO1, 0, 3 * sizeof(float))
根据ARRAY_BUFFER存储位置,可能cpu->gpu, 也可能gpu->gpu
需使用glEnableVertexAttribArray 启用对应的VAA
glViewport 2.0
设置视口
GLint x, 左下角
GLint y,
GLsizei width,
GLsizei height
glViewportArrayv 4.1
设置多个视口
GLuint first,
GLsizei count,
const GLfloat *v
glViewportIndexedf 4.1
设置指定视口