View Full Version : NURBS

01-22-2006, 01:08 AM
Hi , I have an question.
My code would look like this:

void CALLBACK vertexCallback(GLfloat *vertex)
printf ("glVertex3f (%5.3f, %5.3f, %5.3f) \n", vertex[0], vertex[1], vertex[2]);

gluNurbsCallback(theNurb, GLU_NURBS_VERTEX, vertexCallback);

As compile it, the error is : error C2664: “gluNurbsCallback” : can't translate the parameter 3 from“void (GLfloat *)”to

In glu 1.3 Spec , the funtion "gluNrubsCallback" is defined as: void gluNrubsCallback(GLUnurbsObj *nobj,GLenum which,void (*fn)() ); , and the funtion "vertex" is defined as :void vertex(GLfloat *vertex);

Why , who can help me ?

01-22-2006, 04:26 AM
(note: it's already established from the error code this is on Windows, using some MSVC compiler)

If this is in C code, use the CALLBACK macro (evalutates to __stdcall) for your callback definition (and declaration, if it's separate).

If this is in C++ code, switch to C for this (single problem). No, really, do it, it's the only reasonable solution if you're not prepared to cast function pointers. C++ has type safety. I could elaborate and ask you to open GL/glu.h and check the function declaration of gluNurbsCallback, but I won't.

Thread closed, I think.