PDA

View Full Version : gluTess does not work?



PeterPopov
03-22-2002, 09:26 AM
I tried to do CSG operation b0b1b2b3 SUB a0a1a2a3.

double a0[]={14.022423853417965, 18.699999999999992, 0.000000000000004};
double a1[]={-14.022423853417964, 18.700000000000010, 0.000000000000004};
double a2[]={-14.022423853417962, -18.699999999999964, 0.000000000000004};
double a3[]={14.022423853417964, -18.700000000000106, 0.000000000000004};


double b0[]={-17.00000000000000, 17.000000000000007, 0.000000000000000};
double b1[]={-17.00000000000000, -16.999999999999943, 0.000000000000000};
double b2[]={17.000000000000000, -17.000000000000114, 0.000000000000000};
double b3[]={17.000000000000000, 16.999999999999993, 0.000000000000000};

as:

GLUtesselator *tobj;
tobj = gluNewTess();

gluTessCallback(tobj, GLU_TESS_COMBINE, (GLvoid (__stdcall *) ( )) mcombine);
gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid (__stdcall *) ( )) glVertex3dv);
gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid (__stdcall *) ( )) glBegin);
gluTessCallback(tobj, GLU_TESS_END, (GLvoid (__stdcall *) ( )) glEnd);
gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);
gluTessProperty(tobj, GLU_TESS_BOUNDARY_ONLY, GLU_FALSE);

gluTessBeginPolygon(tobj, NULL);

gluNextContour(tobj, NULL);
gluTessVertex(tobj,a3,a3);
gluTessVertex(tobj,a2,a2);
gluTessVertex(tobj,a1,a1);
gluTessVertex(tobj,a0,a0);

gluNextContour(tobj, NULL);
gluTessVertex(tobj,b0,b0);
gluTessVertex(tobj,b1,b1);
gluTessVertex(tobj,b2,b2);
gluTessVertex(tobj,b3,b3);

gluTessEndPolygon(tobj);
gluDeleteTess(tobj);

gluTess do not generate one pair of intersection ponts, so the picture look damaged. With coordinates clamped to the nearest integer, gluTess works fine. But topology does not change!