Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Nurbs Callback Error

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    2

    Nurbs Callback Error

    Can anyone tell me how to install the Nurbs callback function correctly?

    My code looks like this

    GLUnurbsObj *pNurb = NULL;
    pNurb = gluNewNurbsRenderer();

    // Install error handler to notify user of NURBS errors
    gluNurbsCallback(pNurb, GLU_ERROR, &NurbsErrorHandler);


    gluNurbsProperty(pNurb, GLU_SAMPLING_TOLERANCE, 25.0);
    gluNurbsProperty(pNurb, GLU_DISPLAY_MODE, (GLfloat) GLU_FILL);

    gluBeginSurface(pNurb);
    gluNurbsSurface(pNurb,
    aIndexU+aDegU+2, uKnot,
    aIndexV+aDegV+2, vKnot,
    8*3,
    3,
    &ControlPoints[0][0][0],
    aIndexU+1,
    aIndexV+1,
    GL_MAP2_VERTEX_3);
    gluEndSurface(pNurb);

    ....

    // NURBS callback error handler
    void NurbsErrorHandler(GLenum nErrorCode )
    {
    char cMessage[64];


    // Extract a text message of the error
    strcpy(cMessage,"NURBS error occured: ");
    strcat(cMessage,gluErrorString((GLenum) nErrorCode));

    // Display the message to the user
    // MessageBox(NULL,cMessage,NULL,MB_OK | MB_ICONEXCLAMATION);
    }

    The compile error I get is.

    cannot convert parameter 3 from 'void (__cdecl *)(unsigned int)' to 'void (__stdcall *)(void)'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast

    Thanks in advance.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: Nurbs Callback Error

    Do the following:

    // Install error handler to notify user of NURBS errors
    gluNurbsCallback(pNurb, GLU_ERROR, (void (__stdcall *) (void)) &NurbsErrorHandler);

    That's a function typecast... It took me quite a long time to find how to declare those callbacks properly !

    Have fun !

    Eric

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    2

    Re: Nurbs Callback Error

    Thanks Eric, thats really helpful.

    JonG

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •