Problems with Quadrics

I am having trouble registering a callback function for gluQuadricCallback. The definition states that it takes a paramterless function, but the documentation says that an error code will be passed to my function. The OpenGL example code “quadric.c” does not compile with the following error:

invalid conversion from void(*)(unsigned int) 'toGLvoid(*)()’

The method signature is as follows:

void errorCallback(GLenum error);

How do I get gluQuadricCallback to take a function pointer for this method.

You’ll have to explicitly cast it:

gluQuadricCallback( quad, GLU_ERROR, ( GLvoid(*)() ) errorCallback);

  • Taylor

Thank you for the response. The cast makes everything compile successfully. Is there a way to stress the GL so that I can cause a quadric error? I would like to check my error handling code, but don’t know how to cause a quadric error. Why would the GL specification cause you to cast the function pointer instead of specifiying the correct signature?