PDA

View Full Version : Tessellation problem



ammuselvi
08-06-2004, 03:30 AM
In my code,I need to draw some complex polygons. I tried for tessellation. While compiling ,I got the following error. This is the first time I'm trying for tessellation. Pls guide me.............

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

mikael_aronsson
08-06-2004, 05:57 AM
Hi !

The callback function must be a C function (use a .c file or extern "C" { code }).

Just make sure your callback is correct and then you may need to typecast it to void function with void arguments, this is because the gluTessCallback function must handle callback functions with different arguments so they made it void in the declaration.

Mikael

08-06-2004, 01:26 PM
example:

[CODE]
#ifndef CALLBACK
#define CALLBACK
#endif

void CALLBACK begin(GLenum type)
{
// do something useful
}


// later in some function
gluTessCallback(tess, GLU_TESS_BEGIN, (void(CALLBACK*)(void))begin );

[CODE]

the trick is to cast all your functions with (void(CALLBACK*)(void)).

08-06-2004, 01:37 PM
or, if you prefer readability:


#ifndef CALLBACK
#define CALLBACK
#endif

typedef void(CALLBACK *TessCallbackType)(void);

void CALLBACK begin(GLenum type)
{
// do something useful
}

// later in some function
gluTessCallback(tess, GLU_TESS_BEGIN, (TessCallbackType)begin );

ammuselvi
08-06-2004, 10:06 PM
Originally posted by <stubs>:
or, if you prefer readability:


#ifndef CALLBACK
#define CALLBACK
#endif

typedef void(CALLBACK *TessCallbackType)(void);

void CALLBACK begin(GLenum type)
{
// do something useful
}

// later in some function
gluTessCallback(tess, GLU_TESS_BEGIN, (TessCallbackType)begin );

ammuselvi
08-06-2004, 10:10 PM
Thank u so... much for ur reply. I got it!!


Originally posted by <stubs>:
or, if you prefer readability:


#ifndef CALLBACK
#define CALLBACK
#endif

typedef void(CALLBACK *TessCallbackType)(void);

void CALLBACK begin(GLenum type)
{
// do something useful
}

// later in some function
gluTessCallback(tess, GLU_TESS_BEGIN, (TessCallbackType)begin );