View Full Version : Tesselation Callback function with glu

06-20-2002, 07:47 AM
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?


06-20-2002, 06:22 PM
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.

06-21-2002, 02:59 AM
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

gluTessCallback(tobj,GLU_TESS_ERROR,errorCallback) ;

// subroutine

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

// here an example with implicit
conversion to GLenum


06-21-2002, 08:07 PM
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)

06-28-2002, 02:55 AM
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?

06-28-2002, 03:50 AM
Sorry I forgot the typedef command
in the line

typedef void (GLAPIENTRY *_GLUfuncptr)();

06-28-2002, 05:40 AM
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);

07-01-2002, 11:39 PM
Thank's Zico! It works.