Drawing bezier surface

Started by
3 comments, last by Bleed 18 years, 1 month ago
Hi everybody I calculated the points of a bezier surface using casteljau's algorithm Now I got a std::vector with about 10.000 points in series, so if I try to draw 'em with GL_QUADS or GL_QUAD_STRIP I obtain a messy series of lines. Is there any way of draw this points or I need to change the type of structure?
Advertisement
you may have to use opengl evaluators and pass them the control points. How about explaining ur problem a bit more in detail
Well, let's say that the surface is made like this:

p01 p02 p03 p04 p05
p06 p07 p08 p09 p10
p11 p12 p13 p14 p15
p16 p17 p18 p19 p20
p21 p22 p23 p24 p25

where p is the (x,y,z)
In my list I have the points in this order: p01 p06 p11 p21 p02 p07 p12 p17 p22 p03 p08 etc...

If I vertex those points is the mess on earth..
Because I should vertex them in this sequence to obtain a solid surface: p01 p02 p06 p07 p11 p12 p16 p17 etc...

any ideas?
Quote:Original post by Bleed
Well, let's say that the surface is made like this:

p01 p02 p03 p04 p05
p06 p07 p08 p09 p10
p11 p12 p13 p14 p15
p16 p17 p18 p19 p20
p21 p22 p23 p24 p25

where p is the (x,y,z)
In my list I have the points in this order: p01 p06 p11 p21 p02 p07 p12 p17 p22 p03 p08 etc...

If I vertex those points is the mess on earth..
Because I should vertex them in this sequence to obtain a solid surface: p01 p02 p06 p07 p11 p12 p16 p17 etc...

any ideas?
You could do it in immediate mode (slow), or you could use indexed arrays (better), but one way or another you'll have to tell OpenGL what order to process the vertices in. For example, the index list might be something like:
1, 6, 2, 6, 7, 2, 6, 11, 7, 11, 12, 7
And so on.

Does that help at all?
The surface is made by uxv points
I arranged to split the list in an array of u lists
So i vertex the surface by strips, drawing step by step list and list[u+1] points.
for(int a=0; a < points[a].size() - 1; a++){	glBegin(GL_TRIANGLE_STRIP);	list<point3D<float>*>::iterator j = points[a+1].begin();	for(list<point3D<float>*>::iterator i = points[a].begin(); i != points[a].end(); i++){		glVertex3f((*i)->GetX(), (*i)->GetY(), (*i)->GetZ());		glVertex3f((*j)->GetX(), (*j)->GetY(), (*j)->GetZ());		j++;	}	glEnd();}




Thanks anyway

This topic is closed to new replies.

Advertisement