-
-
Save daniel-j/1676943 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// VERTEX SHADER | |
attribute vec2 a_position; | |
uniform vec2 u_resolution; | |
uniform vec3 u_palette[256]; | |
varying vec3 v_color; | |
void main() { | |
// convert the pixel positions to -1->+1 (clipspace) | |
vec2 clipSpace = ((a_position / u_resolution) * 2.0) - 1.0; | |
int index = int(a_position.x); | |
v_color = u_palette[index]; | |
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment