Skip to content

Instantly share code, notes, and snippets.

@jt0dd
Created August 30, 2018 14:11
Show Gist options
  • Save jt0dd/2842997f9284d6887aedab15538aea5b to your computer and use it in GitHub Desktop.
Save jt0dd/2842997f9284d6887aedab15538aea5b to your computer and use it in GitHub Desktop.
// fragment shaders don't have a default precision so we need
// to pick one. mediump is a good default. It means "medium precision"
precision mediump float;
void main() {
// gl_FragColor is a special variable a fragment shader
// is responsible for setting
gl_FragColor = vec4(1, 0, 0.5, 1); // return redish-purple
}
// an attribute will receive data from a buffer
attribute vec4 a_position;
// all shaders have a main function
void main() {
// gl_Position is a special variable a vertex shader
// is responsible for setting
gl_Position = a_position;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment