How to: Drawing a spline (bezier curve) -Assistance required.


I’ve been trying to draw a curved line using opengl’s glEvalCoord1f, etc… But I cant get an output out of it.

I followed the “One-Dimensional Example: A Simple Bézier Curve” example in here:

But no output as I said.

Where can I find a very simple example of drawing a curved line… from point A to point B and the 2 respective control points?, because all I’ve found was about entire patches, nurb surfaces, etc… And what I need is the easiest and best way to draw a curved line given the 2 points and both controllers.

Thanks in advance.

it’s all in the page you linked, in section “Defining and Evaluating a One-Dimensional Evaluator”

all you need are n control points to evaluate the equations for C(u) and the bernstein polynomial B_n^i.

thanks - it was an error in one of my ortho calls!

by the way is this the fastest way to draw bezier lines? because it gets pretty slow after drawing 100 lines with 20 evaluations on them

if not what is the proper way on displaying various different curved lines ?

do you evaluate the curves each time the scene is redisplayed? in that case, and if the curves are not modified, it would of course be faster to draw them only once into a display list.