missing gluTessBeginContour - runtime error

Hi!

I have the following Code example:

GLUtesselator *tobj = gluNewTess();
if(tobj == NULL ){
return;
}
GLdouble data[3];
gluTessCallback( tobj, GLU_TESS_VERTEX, (void (__stdcall *)(void)) vertexCallback);
gluTessCallback( tobj, GLU_TESS_BEGIN, (void (__stdcall *)(void))beginCallback);
gluTessCallback( tobj, GLU_TESS_END, (void (__stdcall *)(void))endCallback);
gluTessCallback( tobj, GLU_TESS_ERROR, (void (__stdcall *)(void)) errorCallback);
gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
gluTessBeginPolygon( tobj, NULL);
gluTessBeginContour( tobj );
data[0] = 5;
data[1] = 10;
data[2] = 3;
gluTessVertex(tobj, data, data);
data[0] = 2;
data[1] = 2;
data[2] = 1;
gluTessVertex(tobj, data, data);
data[0] = 9;
data[1] = 4;
data[2] = 1;
gluTessVertex(tobj, data, data);
gluTessEndContour(tobj);
gluEndPolygon(tobj);
gluDeleteTess(tobj);

with:
#ifndef
#define CALLBACK
#endif

void CALLBACK beginCallback( GLenum which){
glBegin( which );
}
void CALLBACK endCallback( void ){
glEnd();
}

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

void CALLBACK vertexCallback( GLvoid *vertex){
GLdouble *pointer;

pointer = (GLdouble*) vertex;
glColor3dv(pointer+3);
glVertex3dv((GLdouble*)vertex);

}

void CALLBACK tcbEnd(){
glEnd();
}

void CALLBACK Combine(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **out){
GLdouble vertex = (GLdouble) malloc(sizeof(GLdouble)*6);
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
vertex[3] = 1;
vertex[4] = 0;
vertex[5] = 0.5;
*out = vertex;
}

and I use qt 3.3.0 (with the moc) and msvc 6.0 - and everything compiles quite fine - but whenever
I run the program I get the tess error: missing gluTessBeginContour

what did I do wrong???
Thanx in advance,
Stefan

Try replacing gluEndPolygon() with gluTessEndPolygon().