PDA

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



doodlemunch
12-18-2006, 12:22 PM
Hello,

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:
http://www.rush3d.com/reference/opengl-redbook-1.1/chapter11.html

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.

RigidBody
12-19-2006, 12:50 AM
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.

doodlemunch
12-19-2006, 04:46 AM
thanks - it was an error in one of my ortho calls!

doodlemunch
12-19-2006, 05:07 AM
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 ?

RigidBody
12-19-2006, 05:45 AM
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.