Skip to content

Instantly share code, notes, and snippets.

@slimsag
Created January 13, 2015 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slimsag/0096c11f4579aef7f698 to your computer and use it in GitHub Desktop.
Save slimsag/0096c11f4579aef7f698 to your computer and use it in GitHub Desktop.
var glslVert = []byte(`
#version 120
attribute vec3 Vertex;
attribute vec2 TexCoord0;
uniform mat4 MVP;
uniform vec3 shift;
uniform vec3 scale;
varying vec2 tc;
void main()
{
tc = scale.xy * TexCoord0;
tc += shift.xy;
gl_Position = MVP * vec4(Vertex, 1.0);
}
`)
var glslFrag = []byte(`
#version 120
varying vec2 tc;
uniform sampler2D Texture0;
uniform vec4 palette[64];
void main() {
vec4 t = texture2D(Texture0, tc);
int i = int(t.r * 256.0);
gl_FragColor = palette[i];
}
`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment