Need help with GLU tesselator!!

Hi

I’m having trouble with the GLU tesselation routines. I have arbitrary contours which i wish to tesselate into polygons, but when i use the GLU tesselator on them , it works for some, crashes for others. It crashes at the call to

gluTessEndPolygon(tobj);

Here’s the coordinates of the contour.
If somebody could help me with this it would be greatly appreciated…

Thanks!
Jacob
jacobz@hotmail.com

GLdouble bloc2[47][3] ={
.489217 ,0.0 , 1.534276 ,
.307877 ,0.0 , 1.169045 ,
.302932 ,0.0 , 1.154601 ,
.302121 ,0.0 , 1.139577,
.305517 ,0.0 , 1.124890,
.312622 ,0.0 , 1.111444,
.322652 ,0.0 , 1.099859,
.337616 ,0.0 , 1.088517,
.354552 ,0.0 , 1.080195,
.372717 ,0.0 , 1.074774,
.391460 ,0.0 , 1.072102,
.400773 ,0.0 , 1.071790,
.430567 ,0.0 , 1.073400,
.460056 ,0.0 , 1.078318,
.488778 ,0.0 , 1.086612,
.516201 ,0.0 , 1.098411,
.541656 ,0.0 , 1.113862,
.564266 ,0.0 , 1.133083,
.582884 ,0.0 , 1.156117,
.590246 ,0.0 , 1.169045,
.771586 ,0.0 , 1.534276,
1.892731 ,0.0 , 1.534276,
1.892731 ,0.0 , .388808,
1.604055 ,0.0 , .388808,
1.380055 ,0.0 , .990817,
1.370239 ,0.0 , 1.008400,
1.356126 ,0.0 , 1.022725,
1.339149 ,0.0 , 1.033758,
1.320354 ,0.0 , 1.041579,
1.300495 ,0.0 , 1.046324,
1.280140 ,0.0 , 1.048121,
1.259771 ,0.0 , 1.047038,
1.249731 ,0.0 , 1.045405,
1.221646 ,0.0 , 1.038202,
1.194358 ,0.0 , 1.027795,
1.168618 ,0.0 , 1.014120,
1.145109 ,0.0 , .997033,
1.124671 ,0.0 , .976486,
1.110977 ,0.0 , .957107,
1.100860 ,0.0 , .935723,
1.094986 ,0.0 , .912894,
1.093833 ,0.0 , .889407,
1.097542 ,0.0 , .866105,
1.101132 ,0.0 , .854760,
1.274506 ,0.0 , .388808,
.077804 ,0.0 , .388808,
.077804 ,0.0 , 1.534276
};

Hi !

Could you post your declarations/use for the tesselator ? A list of coordinates can not help us finding a bug if there is one !

Regards.

Eric

Surely, here’s all the code that is used for the tesselation. I wish i could attach a picture with this, that shows what the contour looks like, but i don’t know how & dont see an attachment option here.

Thanks for repsonding!
Jacob

GLUtesselator *tobj;

void beginCallback(GLenum which)
{
glBegin(which);
}

void endCallback(void)
{
glEnd();
glFinish();
}

void errorCallback(GLenum errorCode)
{
const GLubyte *estring;
estring = gluErrorString(errorCode);
fprintf(stderr, "Tesselation error : %s
",estring);
exit(0);
}

void vertexCallback(GLvoid *vertex)
{
const GLdouble *pointer;
pointer=(GLdouble *)vertex;
glVertex3dv(pointer);
}

GLuint startlist;

init_function()
{

startlist = glGenLists(1);

tobj = gluNewTess();
gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid(CALLBACK *)()) &vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid(CALLBACK *)()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END, (GLvoid(CALLBACK *)()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR, (GLvoid(CALLBACK *)()) &errorCallback);

glNewList(startlist, GL_COMPILE);
gluTessBeginPolygon(tobj, NULL);
gluTessBeginContour(tobj);
for(int f=0;f<47;f++){
  gluTessVertex(tobj, bloc2[f],bloc2[f]);
}
gluTessEndContour(tobj);
gluTessEndPolygon(tobj);
glEndList();

}

Add CALLBACK modificator to all tesselation callback functions.
For example:
void CALLBACK beginCallback(GLenum which)