Vertex shader 里面的layout (location = 0)
layout qualifiers 布局限定符
Shader stage input and output variables define a shader stage's interface. Depending on the available feature set, these variables can have layout qualifiers that define what resources they use.
基本语法为:
layout(qualifier1, qualifier2 = value, ...) variable definition
顶点着色器属性索引
Vertex shader attribute index
Vertex shader inputs can specify the attribute index that the particular input uses. This is done with this syntax:
layout(location = attribute index) in vec3 position;
User-defined inputs for vertex shaders are called vertex attributes. They are passed via vertex arrays to the vertex shader from data stored in Buffer Objects.
Vertex shader inputs have attribute location indices that are used in vertex specification to identify a particular input. Most input variables take up only one attribute location index, but certain types (matrices, array inputs, and some double-precision types) can take up more than one index.
更多推荐


所有评论(0)