Skip to content

Instantly share code, notes, and snippets.

@samrat
Created July 5, 2016 15:48
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 samrat/f5f25efd0285694204ce6be5a0e5b7f0 to your computer and use it in GitHub Desktop.
Save samrat/f5f25efd0285694204ce6be5a0e5b7f0 to your computer and use it in GitHub Desktop.
arrowhead in a geometry shader
/* Arrowhead */
float ang = (PI / 6.0) - atan(vDir[0].y, vDir[0].x);
gl_Position = gl_in[0].gl_Position + vec4(vDir[0], 0.0, 0.0) + vec4(-cos(ang)*0.04, sin(ang)*0.04, 0.0, 0.0);
EmitVertex();
gl_Position = gl_in[0].gl_Position + vec4(vDir[0], 0.0, 0.0);
EmitVertex();
ang = -(PI / 6.0) - atan(vDir[0].y, vDir[0].x);
gl_Position = gl_in[0].gl_Position + vec4(vDir[0], 0.0, 0.0) + vec4(-cos(ang)*0.04, sin(ang)*0.04, 0.0, 0.0);
EmitVertex();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment