hello
i wrote this little program juste to test the tesselation with glu
i put a printf in the callback function to view if the result of the tesselation is correct!
#include <GL/glu.h>
#include <stdio.h>
int *i0 = new int;
int *i1 = new int;
int *i2 = new int;
int *i3 = new int;
double v0[3]={0.0,0.0,0.0}, v1[3]={1.0,0.0,0.0}, v2[3]={1.0,1.0,0.0}, v3[3]={0.0,1.0,0.0};
// callback function
void vertex_fn(int *numVert){
static int i=0;
printf("face %d, point %d, numvert %d
", i/3, i%3, *numVert);
i++;
}
int main(){
*i0=0;
*i1=1;
*i2=2;
*i3=3;
// Init tessalation
GLUtesselator *tessobj = gluNewTess();
gluTessCallback(tessobj, GLU_TESS_EDGE_FLAG, NULL);
gluTessCallback(tessobj, GLU_TESS_VERTEX, (GLvoid(*)())vertex_fn);
// Begin tessalation
gluTessBeginPolygon(tessobj, NULL);
//gluTessNormal(tobj,...);
gluTessBeginContour(tessobj);
gluTessVertex(tessobj, v0, i0);
gluTessVertex(tessobj, v1, i1);
gluTessVertex(tessobj, v2, i2);
gluTessVertex(tessobj, v3, i3);
gluTessEndContour(tessobj);
gluTessEndPolygon(tessobj);
gluDeleteTess(tessobj);
}
the result of the printf in the callback function is :
face 0, point 0, numvert 0
face 0, point 1, numvert 1
face 0, point 2, numvert 2
face 0, point 0, numvert 3
the callback function is called only 4 times
it should be called 6 times normaly to perform the tessalation!
thanks for help