Advertisement Jump to content
Sign in to follow this  

glu tesselation callbacks

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone, I'm having some troubles with the glu tesselation callbacks. My custom callbacks do not work, glVertex3dv, glBegin and glEnd do. If i just make my callback functions empty, that makes no difference. I can get them to work when using statically allocated arrays. With dynamic allocations, the prog crashes at run time. I am aware that the glTessVertex function takes an adress rather than copying the data. I have got the feeling im missing something, tough.
GLdouble** points = NULL;
GLdouble poly = {{1.0, 1.0, 0.0}, {1.0, -1.0, 0.0}, {-1.0, -1.0, 0.0} {0.0, 0.0, 0.0} {-1.0, 1.0, 0.0}}

// ....
	points = new GLdouble*[5];
	for(int i=0; i<5; i++){
		points = new GLdouble[3];
		points[0] = poly[0];
		points[1] = poly[1];
		points[2] = poly[2];
// ...

typedef void (__stdcall *GluTessCallbackType)();

void tcbVertex(void *data) {}
void tcbBegin() {}
void tcbEnd() {}

void tesselate(){
	GLUtesselator* tess = gluNewTess();
	if (tess == NULL)
		printf("Creation of tesselation object failed.");

	gluTessCallback (tess, GLU_TESS_BEGIN, reinterpret_cast<GluTessCallbackType>(tcbBegin) );
	gluTessCallback (tess, GLU_TESS_VERTEX, reinterpret_cast<GluTessCallbackType>(tcbVertex) );
	gluTessCallback (tess, GLU_TESS_END, reinterpret_cast<GluTessCallbackType>(tcbEnd) );

	gluTessBeginPolygon(tess, NULL);
	for(i=0; i<5; i++)
		gluTessVertex(tess, points, points);

If someone has any suggestions about what might be wrong about my approach, feel free to make'm, as I am totally clueless. Thanks for reading anyway, greets

Share this post

Link to post
Share on other sites
Never mind, I solved it. For those interested:

on windows the callback functions should be declared:

void CALLBACK somefunction(...){

The CALLBACK is not mentioned in the glu faq as its
platform specific, luckily the all-containing red book
notes it.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!