[Pyrex] Function Pointer

Jiba jiba at tuxfamily.org
Sat Mar 6 11:21:24 CET 2004


On Thu, 4 Mar 2004 21:10:56 +0100
Marco Bubke <marco at bubke.de> wrote:

> On Thursday 04 March 2004 19:41, Jiba wrote:
> > >     gluTessCallback(self._tesselator, GLU_TESS_BEGIN_DATA,
> > > 	<void(*)()>&tesselator_begin)             <<<<<<<<<<<<<<<<<<<
> >
> > Hi,
> >
> > I use GLU callback as following :
> >
> > gluTessCallback(self._tess_obj, GLU_TESS_VERTEX_DATA,  <_GLUfuncptr>
> > vertex_glu_callback)
> >
> > _GLUfuncptr is a dummy C type which is defined in glu.h i believe ;
> > using it is the recommanded way for GLU.
> >
> 
> Oh, I thought thats for internal use? Ok, but how to import this type?
> If I define it myself I get allways void ((*)(void)). Its running but
> calling nothing.

I define it as following (and it works for me) :

cdef extern from "GL/glu.h":
    ctypedef void (*_GLUfuncptr)()

I've seen it used in some OpenGL demo (maybe NEon-HElium ?) ; i don't
think it is for internal use : in glu.h, the definitions are :

typedef void (GLAPIENTRY *_GLUfuncptr)();
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum
which, _GLUfuncptr CallBackFunc);

Jiba




More information about the Pyrex mailing list