pixels/shaders/shader.vert
Jay Oster d0391be62a Initial pass with texture rendering
- The example app generates a scaled version of pixel Ferris as a test.
- TODO:
  - Pixel aspect ratio is still unsupported
  - The `RenderPass` trait is incomplete
2019-10-02 20:22:20 -07:00

37 lines
643 B
GLSL

#version 450
out gl_PerVertex {
vec4 gl_Position;
};
layout(location = 0) out vec2 v_TexCoord;
const vec2 positions[6] = vec2[6](
// Upper left triangle
vec2(-1.0, -1.0),
vec2(1.0, -1.0),
vec2(-1.0, 1.0),
// Lower right triangle
vec2(-1.0, 1.0),
vec2(1.0, -1.0),
vec2(1.0, 1.0)
);
const vec2 uv[6] = vec2[6](
// Upper left triangle
vec2(0.0, 0.0),
vec2(1.0, 0.0),
vec2(0.0, 1.0),
// Lower right triangle
vec2(0.0, 1.0),
vec2(1.0, 0.0),
vec2(1.0, 1.0)
);
void main() {
v_TexCoord = uv[gl_VertexIndex];
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
}