结构体

  • 声明:
GLSL
struct Vertex {
	vec3 position;
}
  • 使用:
GLSL
void main() {
	Vertex vtx;
	vtx.position = vec3(1);
}

接口块

  • 输出接口块:
GLSL
out VertexOut {
	vec3 normal;
	vec2 texCoord;
} vs_out;
  • 输入接口块:结构需要保持与输出时一致
GLSL
in VertexOut {
    vec3 normal;
    vec2 texCoord;
} vs_in;
  • 使用:
GLSL
void main() {
	vs_out.normal = vec3(1);
}

: Cheyne Xie

: https://chaim.eu.org/posts/4469781c/

: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.