I've made an application as an example for this thread on how to compute/evaluate a Cubic Bézier Curve using a Geometry Shader. The formula is pretty straightforward as presented by this article (look for Cubic Bézier Curve). I will not go over the bézier math or theory. I assume you have some knowledge in shader programming (GLSL is the case) and some math background would help, while not really a need. All that said, let's get to work. On this case we will need 4 points: 2 anchor points (the line end points) and 2 control points. The control points won't really touch the curve, they work more as directional information on the curve itself. As we need to send this data to the shader i have decided to use LINES as input primitive, 2 points define a line so it's perfect, we will use it to pass both anchor points. As for the control points i used 2 different texture units (glMultiTexCoord3f) attached to the line's vertex data. Using geometry shaders besides setting the input primitive type we are usi
More
Support this project and others with 1-click micro-donations
