Opengl 将统一缓冲区对象与GLMultiDrawerElementsInDirect一起使用的最佳方法是什么?
我想知道在这个抽签调用中使用UBO的最佳方法是什么?我已经实现了一个UBO,它工作得很好,但我正在尝试升级我的渲染器,但不知道如何将它与GLMultiDrawerElementsInDirect一起使用。UBO是否存储每个实例的所有制服,而在着色器中我只是使用实例id查找它们 是这样的吗Opengl 将统一缓冲区对象与GLMultiDrawerElementsInDirect一起使用的最佳方法是什么?,opengl,Opengl,我想知道在这个抽签调用中使用UBO的最佳方法是什么?我已经实现了一个UBO,它工作得很好,但我正在尝试升级我的渲染器,但不知道如何将它与GLMultiDrawerElementsInDirect一起使用。UBO是否存储每个实例的所有制服,而在着色器中我只是使用实例id查找它们 是这样的吗 layout(location = 0) in float instanceId; layout(std140) uniform Matrices { mat4 projView[]; }; voi
layout(location = 0) in float instanceId;
layout(std140) uniform Matrices
{
mat4 projView[];
};
void main()
{
gl_Position = projView[int(instanceId)] * vec4(pos, 1.0);
}
(显然,这不是完整的着色器,但我认为这让人明白了这一点)
谢谢