Example 1.2. Buffer Object Initialization
代码语言:javascript复制void InitializeVertexBuffer()
{
glGenBuffers(1, &positionBufferObject); // 生成缓存对象,没有分配内存
glBindBuffer(GL_ARRAY_BUFFER, positionBufferObject); // 绑定对象
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexPositions), vertexPositions, GL_STATIC_DRAW); //分配GPU内存,拷贝数据
glBindBuffer(GL_ARRAY_BUFFER, 0); // 解除绑定
}
代码语言:javascript复制glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0); // 解析缓存对象的数据格式
Variables defined as uniform do not change at the same frequency as variables defined as in. Input variables change with every execution
of the shader. Uniform variables (called uniforms) change only between executions of rendering calls. And even then, they only change when the user sets them explicitly to a new value.
OpenGL的渲染流水线:
https://blog.csdn.net/qq_29523119/article/details/78577246
11