[rs] Avoid array indexing in hello-triangle

This commit is contained in:
Joshua Groves
2020-03-28 23:52:00 -02:30
committed by Dzmitry Malyshau
parent ef1e47216e
commit 652c7242fb
2 changed files with 2 additions and 7 deletions

View File

@@ -4,12 +4,7 @@ out gl_PerVertex {
vec4 gl_Position;
};
const vec2 positions[3] = vec2[3](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
vec2 position = vec2(gl_VertexIndex, (gl_VertexIndex & 1) * 2) - 1;
gl_Position = vec4(position, 0.0, 1.0);
}