7DRL2015/data/shaders/sprite_vs.glsl

16 lines
463 B
GLSL

#version 150
// our projection and translation matrices
uniform mat4 proj_matrix, mv_matrix;
// attributes
attribute vec3 vp; // vertex position
attribute vec2 uv; // UV map
uniform vec2 uv_offset; // offset within the UV map
// output
varying vec2 frag_uv;
void main() {
vec4 eye = mv_matrix * vec4(vp, 1.0);
gl_Position = proj_matrix * eye;
frag_uv = vec2(uv.s+uv_offset.x, 1.0 - uv.t+uv_offset.y);
//frag_uv = vec2(uv.s, 1.0 - uv.t);
}