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 4 of 4

Thread: Polygon tessellation problem

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2001
    Posts
    21

    Polygon tessellation problem

    Hi! I have encountered compile-time error when I try to use tessellator for concave polygon. Anyone know why is this so?

    VC++ 6.0 Compile-time Error:
    ------------------------------
    error C2664: 'gluTessCallback' : cannot convert parameter 3 from 'void (unsigned int)' to 'void (__stdcall *)(void)'
    None of the functions with this name in scope match the target type

    part of my code:
    -----------------
    glShadeModel(GL_SMOOTH);
    glColor3f(0.42f, 0.35f, 0.03f);
    GLdouble tess_ver[3];
    GLUtesselator* tess;
    tess = gluNewTess();

    gluTessCallback(tess, GLU_TESS_BEGIN, glBegin);
    gluTessCallback(tess, GLU_TESS_VERTEX, glVertex3dv);
    gluTessCallback(tess, GLU_TESS_END, glEnd);

    gluTessBeginPolygon(tess, NULL);
    gluTessBeginContour(tess);
    glNormal3f(0.0f, 1.0f, 0.0f);
    tess_ver[0] = ...
    tess_ver[1] = ...
    tess_ver[2] = ...
    gluTessVertex(tess, tess_ver, NULL);
    gluTessEndContour(tess);
    gluEndPolygon(tess);

    -----------------
    The error is on the line gluTessCallback(.....BEGIN....) and gluTessCallback(.....END....)
    but not on the line gluTessCallback(....VERTEX....)
    Thanks in advance!!!

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2000
    Location
    France
    Posts
    1,118

    Re: Polygon tessellation problem

    This is how it works:

    Code :
    void APIENTRY TessBeginData(GLenum Type,void *Polygon);
    void APIENTRY TessEndData(void *Polygon);
    void APIENTRY TessEdgeFlagData(GLboolean Flag,void *Polygon);
    void APIENTRY TessVertexData(void *Vertex,void *Polygon);
    void APIENTRY TessCombineData(GLdouble Coords[3],void *Vertex[4],GLfloat Weight[4],void **Out,void *Polygon);
    void APIENTRY TessErrorData(GLenum Errno,void *Polygon);
     
    void SetTesselator(void)
    {
     
      gluTessCallback(myTesselator,GLU_TESS_BEGIN_DATA,(void (__stdcall *) (void)) &TessBeginData);  
      gluTessCallback(myTesselator,GLU_TESS_END_DATA,(void (__stdcall *) (void)) &TessEndData);  
      gluTessCallback(myTesselator,GLU_TESS_EDGE_FLAG_DATA,(void (__stdcall *) (void)) &TessEdgeFlagData);  
      gluTessCallback(myTesselator,GLU_TESS_VERTEX_DATA,(void (__stdcall *) (void)) &TessVertexData);
      gluTessCallback(myTesselator,GLU_TESS_COMBINE_DATA,(void (__stdcall *) (void)) &TessCombineData);  
      gluTessCallback(myTesselator,GLU_TESS_ERROR_DATA,(void (__stdcall *) (void)) &TessErrorData);  
     
    }
    In your example, try:

    Code :
    gluTessCallback(tess, GLU_TESS_BEGIN, ,(void (__stdcall *) (void)) &glBegin);
    gluTessCallback(tess, GLU_TESS_VERTEX, ,(void (__stdcall *) (void)) &glVertex3dv);
    gluTessCallback(tess, GLU_TESS_END, ,(void (__stdcall *) (void)) &glEnd);
    This is basically a function pointer typecast problem...

    Regards.

    Eric


    [This message has been edited by Eric (edited 01-18-2001).]

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2001
    Posts
    21

    Re: Polygon tessellation problem

    Thank you very much. However, after trying your suggestion solution, although it can be compiled successfully, the program was abnormally terminated when it runs. Any idea?

    Thanks a lot in advance!!

  4. #4
    Junior Member Regular Contributor
    Join Date
    Feb 2000
    Location
    Caracas/Venezuela
    Posts
    182

    Re: Polygon tessellation problem

    I think you should remove the '&' from Erics suggestion.

Posting Permissions

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