Skip to content

Instantly share code, notes, and snippets.

View anselm's full-sized avatar

anselm anselm

View GitHub Profile
@anselm
anselm / openglribbon.java
Created December 13, 2011 22:17
A snippet of code to draw opengl ribbons given a series of connected line segments
// Note that I wrote this in java in Processing - paste this GIST into processing to see it in action.
// It is not the most elegant thing ever but it does deal with end caps and ribbon loops and the like.
// If you port this over to say objective-c / opengl / c etc - you may need to deal with polygon direction
// here is a snapshot of it running : http://www.flickr.com/photos/anselmhook/6507471719/in/photostream
int nvertices = 0;
float[] vertexpool = new float[3000];
float x1,x2,y1,y2;
void intersect(int kind, float x0, float y0, float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4) {