Skip to content

Instantly share code, notes, and snippets.

@ZeroStride
Created July 9, 2013 20:07
Show Gist options
  • Save ZeroStride/5960795 to your computer and use it in GitHub Desktop.
Save ZeroStride/5960795 to your computer and use it in GitHub Desktop.
in vec3 InPosition;
in vec2 InTex0;
out vec2 tex_coord0;
out vec4 color0;
uniform vec4 color;
uniform mat4 object_to_screen;
uniform vec2 frame_width_height; // vec2(frame_width, frame_height)
uniform vec2 tex_width_height; // vec2(frame_width * num_animation_frames, frame_height * num_character_ids)
uniform vec2 frame_character; // vec2(animation_frame_id / (num_animation_frames - 1), character_id / (num_character_ids - 1))
void main()
{
gl_Position = object_to_screen * vec4(InPosition, 1.0);
tex_coord0 = (InTex0.xy * frame_width_height + frame_character * frame_width_height) / tex_width_height;
color0 = color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment