Something went wrong. Try again.
art software for the rest of us
drawing paint image sdl art
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031#version 450
// Instance attributeslayout(location = 0) in vec4 in_rect; // x, y, width, heightlayout(location = 1) in vec4 in_color; // r, g, b, a
layout(location = 1) out vec4 out_color;layout(location = 2) out vec2 out_uv;
layout(set = 1, binding = 0) uniform PushConstants { vec2 windowSize;} pc;
void main() { vec2 rectPos = in_rect.xy; vec2 rectSize = in_rect.zw;
vec2 cornerOffset = vec2( float(gl_VertexIndex & 1), float((gl_VertexIndex >> 1) & 1) );
vec2 pixelPos = rectPos + (cornerOffset * rectSize); vec2 ndc = (pixelPos / pc.windowSize) * 2.0 - 1.0; ndc.y = -ndc.y; gl_Position = vec4(ndc, 0.0, 1.0);
out_color = in_color; out_uv = cornerOffset;}