Tesselation Callback function with glu

I have problems to compile the gluTessCallback
command under GLU Version 1.3
if I use the callbackfunction with parameters
unequal void. The error message is
ANSI C++ prohibits conversion from
(const GLfloat *) to (…).
Could anyboddy help?


The quick and dirty way is to do a typecast. If you do not like that do you have to post some code for further help.

Hi Zico,
Here one example (similar to examle 11-1 in Open GL Programming Guide Version 1.2 . p.472)

#ifndef CALLBACK

GLUtesselator *tobj;

tobj = gluNewTess();

//z.B.call of function errorCallback


// subroutine

void CALLBACK errorCallback(GLenum errorCode)
const GLubyte *estring;
estring = gluErrorString(errorCode);
fprintf(stderr,"Tesselation Error: %s

// here an example with implicit
conversion to GLenum


Are you sure that your example demonstrtates the problem? No conversions takes place in the callback function. I tried the 11-1 example from the earlier version of the book about OpenGL 1.1. If I try to compile it as C++ code do I have some problem with the last line in this function:

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

pointer = (GLdouble *) vertex;
glVertex3dv( vertex);

As mentioned before does a type cast work
glVertex3dv((const GLdouble *) vertex);
the extra varible could also be used
glVertex3dv(pointer );
but the best solution is probably to change the function

void CALLBACK vertexCallback(const GLdouble *vertex)

Hi Zico,

Your example work with GLU Version 1.1
There I got only a warning
ANSI C++ prohibits conversion from ‘()’ to ‘(…)’ for the gluTessCallback() call.

The are differences in the glu Versions which could be responsible for the problems

from glu.h Version 1.1

GLUAPI void APIENTRY gluTessCallback(GLUtriangulatorObj *tobj,
GLenum which, void (CALLBACK *fn)() )
from glu.h Version 1.3

void (GLAPIENTRY *_GLUfuncptr)();

GLAPIENTRY gluTessCallback (GLUtesselator *tess, GLenum which, _GLUfuncptr CallBackFunc);

Any Idea?

Sorry I forgot the typedef command
in the line

typedef void (GLAPIENTRY *_GLUfuncptr)();

Right, I think that I missunderstood your question. If you look at the red book example will you find type casts in the gluTessCallback calls like this:

gluTessCallback(tobj, GLU_TESS_VERTEX,
(GLvoid (CALLBACK*) ()) &vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN,
(GLvoid (CALLBACK*) ()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END,
(GLvoid (CALLBACK*) ()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR,
(GLvoid (CALLBACK*) ()) &errorCallback);
gluTessCallback(tobj, GLU_TESS_COMBINE,
(GLvoid (CALLBACK*) ()) &combineCallback);

Thank’s Zico! It works.

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