juliet/shaders/sprite_vs.glsl

16 lines
453 B
GLSL

#version 120
// input
uniform vec2 resolution; // display resolution
attribute vec3 vp; // vertex position
uniform vec2 vp_offset; // vertex offset (draw position)
attribute vec2 uv; // UV map
uniform vec2 uv_offset; // offset within the UV map
// output
varying vec2 frag_uv;
void main() {
vec2 pos = vp.xy + vp_offset;
gl_Position = vec4(pos/resolution, 1.0, 1.0);
frag_uv = vec2(uv.s+uv_offset.x, 1.0 - uv.t+uv_offset.y);
}