PDA

View Full Version : Tesselator callbacks - Please help



dja98
05-23-2002, 09:49 AM
I am trying to use OpenGL's tesselator to triangulate a concave polygon.

I don't want to use OpenGL to draw the polygon, just get the data.

Can anyone explain to me how to do this. I can't get my callback functions to work.

typedef void (__stdcall *GluTessCallbackType)();

void __stdcall TriVertexData(GLdouble* vertex_data, CFrame* polygon_data){...}

GLUtesselator* tess = gluNewTess();
gluTessCallback(tess, GLU_TESS_END_DATA, reinterpret_cast<GluTessCallbackType>(TriEndData));
gluTessCallback(tess, GLU_TESS_VERTEX_DATA, reinterpret_cast<GluTessCallbackType>(TriVertexData));


gluTessBeginPolygon(tess, ArchitectureFrame);
gluTessBeginContour(tess);

for (k=0;k<points;k++){
gluTessVertex(tess, Poly1Points[k],Poly1Points[k]);
}

gluTessEndContour(tess);
gluTessEndPolygon(tess);

NordFenris
05-23-2002, 09:55 AM
Yes, AAMOF I sat, cursing VC++, the other day, and I did solve this.

You want to register them like so:

gluTessCallback (tobj, GLU_TESS_BEGIN, (GLvoid (CALLBACK *) ()) &TessBegin);

Do this, whatever your parameters may be.

dja98
05-23-2002, 10:20 AM
Still no joy,
The code compiles and runs but my callbacks are not being called.

any ideas