When I try to integrate a Tessellation Object in a MFC application I get the following fault message:

gluTessCallback: third parameter from void in void (__stdcall *)(void) not convertible.

I using the same procedure like in the programm

tobj = gluNewTess();

gluTessCallback(tobj, GLU_TESS_VERTEX, glVertex3dv);
gluTessCallback(tobj, GLU_TESS_BEGIN, (beginCallback(GL_TRIANGLES)));
gluTessCallback(tobj, GLU_TESS_END, endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR, errorCallback);

GLdouble currentWinding = GLU_TESS_WINDING_ODD;

list = glGenLists(0);

void CALLBACK COpenGLFeatures::errorCallback(GLenum errorCode)


void CALLBACK COpenGLFeatures::endCallback(void)

Any idea ? Let it me know.


In the class, declare the callback functions as

class XXXXX
static void CALLBACK beginCallback(GLenum which);
static void CALLBACK endCallback(GLenum error);
static void CALLBACK errorCallback();

In the CPP file, you don’t need to put CALLBACK, but I guess you can leave them in

void COpenGLFeatures::errorCallback(GLenum errorCode)


and you need to do function casting

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

gluTessCallback(tobj, GLU_TESS_END, (GLvoid (CALLBACK*) ()) &endCallback);

gluTessCallback(tobj, GLU_TESS_ERROR, (GLvoid (CALLBACK*) ()) &errorCallback);

and that should do it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.