Example 1.2. Buffer Object Initialization
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); // 解除绑定
}
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.youkuaiyun.com/qq_29523119/article/details/78577246
11
博客介绍了OpenGL中缓冲区对象初始化,提到uniform变量与in变量变化频率不同,输入变量随着色器每次执行改变,uniform变量仅在渲染调用间且用户显式设置新值时改变,还给出了OpenGL渲染流水线相关链接。
4338

被折叠的 条评论
为什么被折叠?



