Created
January 13, 2015 00:22
-
-
Save emidoots/0096c11f4579aef7f698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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