Files
Vulkan-Samples/shaders/texture_loading/glsl/bg.vert
T
2025-09-15 22:31:52 +08:00

14 lines
367 B
GLSL

#version 450
layout(location = 0) out vec2 uv;
void main() {
// 使用NDC坐标(-1到1),并为四个顶点分配位置
vec2 positions[4] = vec2[](
vec2(-1.0, -1.0), vec2(1.0, -1.0),
vec2(-1.0, 1.0), vec2(1.0, 1.0)
);
uv = positions[gl_VertexIndex].xy * 0.5 + 0.5;
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
}