putting tex coords on bezier curves

hi,

I am using line strips to make a bezier curve and was wanting to apply a texture to the curve (3d).

for (j = 0; j <= 8; j++) {
glBegin(GL_LINE_STRIP);
	for (i = 0; i <= 30; i++)
		glEvalCoord2f((GLfloat)i/30.0, (GLfloat)j/8.0);
glEnd();

glBegin(GL_LINE_STRIP);
	for (i = 0; i <= 30; i++)
		glEvalCoord2f((GLfloat)j/8.0, (GLfloat)i/30.0);
glEnd();
}

Does anybody know how I would go about this?

Thanks :stuck_out_tongue:

for (j = 0; j <= 8; j++) {
glBegin(GL_LINE_STRIP);
for (i = 0; i <= 30; i++)
{
glTexCoord2f( i/30,j/8);
glEvalCoord2f((GLfloat)i/30.0, (GLfloat)j/8.0);
}
glEnd();

glBegin(GL_LINE_STRIP);
	for (i = 0; i &lt;= 30; i++)
	{
		glTexCoord2f(j/8,i/30);
		glEvalCoord2f((GLfloat)j/8.0, (GLfloat)i/30.0);
	}
glEnd();
}

You could try to use evaluators to do it, but I wouldn’t recommend it - it tends to look horrible. Doing it linearly gives nice coverage.

Great, thanks!

I will try it… in my desperation i was going to use evaluators, but tough better of it

arrrg something’s not working properly… trying to figure out now

Mail me with an address I can post to & I’ll send you some stuff that may be of use…

yup, emailed you did you get it?

Tried to mail you some stuff, I hope you get it (I’ve problems with my e-mail at the moment)

Wow! that’s great thanks! Im just trying it out now… also thanks heaps for the document on bezier curves. :stuck_out_tongue:

No Probs

[This message has been edited by Rob The Bloke (edited 07-27-2001).]

Would you be able to explain your code that init’s m_pIndicies?

I think i understand, but I just want to get it sorted in my head :stuck_out_tongue:

Thanks
ps do you have and icq num?

m_pIndicies is an array of vertex array indices that defines a load of triangle strips.

say you have a surface with a lod of three (4*4 vertices produced):





it lays out the indicies in the array as follows - these numbers relate to the position within the array itself - not the value…



1 3 5 7

0 2 4 6

that will be the first strip. The numbers stored will be the position of the related vertex in the m_pVertexArray. Note - in the Draw() function it draws a bunch of triangle strips. For this surface, there will need to be three strips. The second would then be :


9 11 13 15

8 10 12 14


It uses triangle strips because they are the fastest openGL primative. Draw basically runs through each strip and passes a pointer to the position in the array, of the first index of the required strip.

Hope thats of help. I know the code is a bit un-readable, It used to make perfect sense, but then it got optimised a bit…