PDA

View Full Version : Bad painting with bezier curves



Liso
10-08-2002, 07:48 AM
Hi, I just made a beizer curve algorithm but I've a problem becouse the lines ( with GL_LINE_STRIP ), are corrupted like some pixel don't put.
I don't know what would be the problem, some idea?.
This is the code:

--
hint: the glBegin & glEnd is out of function.

void listBezier(GLfloat controlPoints[3][3])
{

int precision=32;
float dt,B0,B1,B2,x,y;
float i,omi; // one minus i
dt=(float)1/precision;


for(i=1;i>=0;i-=dt)
{
omi= 1-i;
B0=i*i;
B1=2*i*omi;
B2=omi*omi;
x=B0*controlPoints[0][0]+B1*controlPoints[1][0]+B2*controlPoints[2][0];
y=B0*controlPoints[0][1]+B1*controlPoints[1][1]+B2*controlPoints[2][1];
glVertex2d(x,y);
}

return ;
}

Thanks.