Several years ago when I was working on "Bugdom 2" I had to write a
utility that did exactly this. It built a pipe and/or a half-pipe
along a spline for two of the levels in the game where the player
surfed the pipe. I didn't have to do anything particularly
complicated to do this; at least no atan2() calls.
What I did was to build "spars" which were the rings of vertices that
defined the outline of the tube along the spline. Then I would
simply create a mesh from those spars. Below is the function I used
to generate the spars from the spline points:
/*********************** GENERATE SPLINE SPARS **********************/
//
// Generates the spline cross-beam spars which are the base for the
geometry
//
/*******************/
/* BUILD THE SPARS */
/*******************/
//
// Calc a vector from spline pt 0 to spline p1, and then align
// the reference spar to that vector - that's our new spar!
//
for (i = n = 0; i < gNumSplineSpars; i++, n += SPAR_DENSITY)
{
OGLMatrix4x4 m;
This code may not make much sense by itself, or maybe it does, but
the jist of it is that I create a ring of points and then transform
it to align with the spline. That is done at the bottom of the
function by calculating a vector from spline point 0 to spline point
1 and then aligning the ring of points to that vector. Quite simply
actually.
I'll be happy to sent you the entire project for this utility if you
want, but it's an old CodeWarrior project.
-Brian
On May 24, 2007, at 6:42 AM, Lorenzo wrote:
I have to build a pipeline on a Bezier path. My profile is a circle.
For each point of the Bezier curve I have the tangent normalized
vector.
I will draw the pipeline with GL_QUAD_STRIP.
So e.g. for each point "i" of the curve, to calculate the vertexes
of one
circle (which can be rotated anyway on the 3 axes), I iterate from
0 to 360
degrees and get
__________________________________________________________
Brian Greenstone
President & CEO email@hidden
Pangea Software, Inc. http://www.pangeasoft.net
12405 John Simpson Ct. voice/fax: (512)266-9991
Austin, TX 78732
__________________________________________________________
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden