custom glu tesselation

hi,

id like to do some custom glu tesselation and im trying to avoid changing ofGraphics.
main reason behind this is to draw a polygon once, store it and re-draw it using VBO.
this will give a massive performance boost for what im trying to do.

so far i have a class which takes care of working out the tesselation and storing it in a VBO.
just tryng to get the callbacks working and it feels like deciphering hieroglyphs.

  
PolygonShape :: PolygonShape()  
{  
}  
  
PolygonShape :: ~PolygonShape()  
{  
}  
  
void PolygonShape :: init()  
{  
	tessObj = gluNewTess();  
	gluTessCallback( tessObj, GLU_TESS_BEGIN, ( GLvoid (*) () ) &tesselationBegin );  
}  
  
void PolygonShape :: tesselationBegin( GLint type )  
{  
	//  
}  
  

getting the following error,

error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&PolygonShape::tesselationBegin’
error: converting from ‘void (PolygonShape::*)(GLint)’ to ‘GLvoid (*)()’

how can i get the gluTessCallback working so that it calls back a function inside my PolygonShape class?

L.

so played around with function pointers and came up with the following solution for custom glu tesselation.

haven’t been able to work out how to make a callback to a method within a object class.
so i placed my callback methods outside of the object class.
pretty much the same way it is done in ofGraphics.

  
void tesselationVertex( void *data );  
void tesselationBegin( GLint type );  
void tesselationEnd();  
  
void tesselationVertex( void *data )  
{  
	tessShapeFillPoints.push_back( ( (double *)data)[0] );  
	tessShapeFillPoints.push_back( ( (double *)data)[1] );  
	tessShapeFillPoints.push_back( ( (double *)data)[2] );  
}  
  
void tesselationBegin( GLint type )  
{  
	tessShapeFillIndex.push_back( tessShapeFillPoints.size() );  
	tessShapeFillTypes.push_back( type );  
}  
  
void tesselationEnd()  
{  
	//  
}  
  
void Shape :: initTesselator()  
{  
	tessObj = gluNewTess();  
	gluTessCallback( tessObj, GLU_TESS_VERTEX,	(GLvoid(*)())&tesselationVertex );  
	gluTessCallback( tessObj, GLU_TESS_BEGIN,	(GLvoid(*)())&tesselationBegin );  
	gluTessCallback( tessObj, GLU_TESS_END,		(GLvoid(*)())&tesselationEnd );  
}  

having done that, i store my points in a VBO and its super quick when it comes to re-drawing.

L.