首页 > 解决方案 > OpenGL glVertexArrayAttribBinding bindingIndex

问题描述

在 pre-DSA opengl 中,指定顶点数组属性格式的方法是这样的:

glBindVertexArray(VA);
glEnableVertexAttribArray(attribIndex);
glVertexAttribPointer(attribIndex, count, type, normalized, stride, pointer);

使用 DSA 类似于:

glVertexArrayVertexBuffer(VA, bindingIndex, VB, offset, stride);
glEnableVertexArrayAttrib(VA, attribIndex);
glVertexArrayAttribFormat(VA, attribIndex, count, type, normalized, relOffset);
glVertexArrayAttribBinding(VA, attribIndex, bindingIndex);

我的问题是:

  1. 什么是 bindingIndex,它有什么作用?
  2. 为什么 glVertexArrayAttribFormat 与 glVertexArrayAttribBinding 分开?这样做有什么好处吗?
  3. 例如,它与统一缓冲区绑定点有什么关系?

标签: openglopengl-4

解决方案


推荐阅读