Skip to content

Instantly share code, notes, and snippets.

@croepha
Created June 23, 2019 18:12
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 croepha/1546e72b2dab85ae755b815196f822fb to your computer and use it in GitHub Desktop.
Save croepha/1546e72b2dab85ae755b815196f822fb to your computer and use it in GitHub Desktop.
char* vertex_shader =
"#version 100\n"
"attribute highp vec3 mesh_xyz;\n"
"attribute highp vec4 mesh_color;\n"
"uniform highp mat4 model_view;\n"
"uniform highp mat4 projection;\n"
"varying highp vec4 vertex_color;\n"
"varying highp vec4 vertex_position;\n"
"void main () {\n"
" vertex_color = mesh_color;\n"
" vertex_position = gl_Position = projection * model_view * vec4(mesh_xyz, 1);\n"
"}\n"
;
char* fragment_shader =
"#version 100\n"
"varying highp vec4 vertex_color;\n"
"varying highp vec4 vertex_position;\n"
"void main () {\n"
" if (distance(vertex_position, gl_FragCoord) < 10.0) {\n"
" gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n"
" } else {\n"
" gl_FragColor = vertex_color;\n"
" }\n"
"}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment