Help with Tesselation

I have tried to follow the red book and other examples with various combinations and cannot get a simple tesslation to work. Can Someone help with a working example? thks I can email code - however this board won’t allow me to post it for some reason.

glpanel.cpp:612: error: argument of type void (GLPanel: :) (unsigned int)' does not matchGLvoid ()()’
glpanel.cpp:613: error: invalid conversion from void (*)(const GLdouble*)' toGLvoid (
glpanel.cpp:615: error: void value not ignored as it ought to be
glpanel.cpp:616: error: argument of type void (GLPanel: :) (unsigned int)' does not matchGLvoid (*)()’

Hi !

The compiler tries to compile it as C++ code, the C++ compiler is much more strict about syntax so you need to modify your code a little to make it work.

If something is declared to take no arguments (void) then you cannot use a function with for example an integer argument.

The OpenGL API is in C so the best thing is to stick as much as possible to C code when you use OpenGL AFAIAK, then you can of course put some C++ layer on top of that.

To make sure a function is useful as a callback use extern “C” { your code } and make sure you get the calling convention correct.


Yes, I am using C++ and you’re right - most examples are C based, but I would prefer to keep C++ syntax. As far as making syntax changes, I agree however have been unsuccessful, thus need some examples. Here is the callback code I have
//----- set callbacks -------
gluTessCallback(tess, GLU_TESS_BEGIN, beginCallback);
gluTessCallback(tess, GLU_TESS_VERTEX, glVertex3dv);
gluTessCallback(tess, GLU_TESS_END, endCallback());
gluTessCallback(tess, GLU_TESS_ERROR, errorCallback);

void errorCallback(GLenum err) {
const char errorString = (char)gluErrorString(err);
void vertexCallback(double v[]) {
// glVertex3dv(v);
void beginCallback(GLenum v) {
void endCallback(GLvoid) {