Hi,
I am trying to tesselate the famous “Star Trek” badge:
GLdouble starTrek [4] [2]
= { +0.4, -0.7,
0.0, +0.7,
-0.4, -0.7,
0.0, 0.0 } ;
However, Windows XP reports that my program “has encountered a problem and needs to close” whenever my contour includes more than 2 vertices (although there is no such complaint when the contour is comprised of 2 or fewer vertices).
Any advice you might have would be much-appreciated.
Dana J.
--------- code snippets follow --------
Here are my callbacks:
void CALLBACK beginCallback ( GLenum which )
{
glBegin ( which ) ;
} // end beginCallback
void CALLBACK endCallback ( void )
{
glEnd ( ) ;
} // end endCallback
void CALLBACK errorCallback ( GLenum errorCode )
{
std::cout << "Tessellation error: " << gluErrorString(errorCode) << std::endl ;
} // end errorCallback
(where there is an empty definition for CALLBACK as suggested on page 493 of Red Book for Version 1.4)
Here’s how I register callbacks:
typedef void (__stdcall * TessFuncPtr)( );
gluTessCallback ( myTesselator, GLU_TESS_VERTEX, (TessFuncPtr) glVertex2dv ) ;
gluTessCallback ( myTesselator, GLU_TESS_BEGIN, (TessFuncPtr) beginCallback ) ;
gluTessCallback ( myTesselator, GLU_TESS_END, (TessFuncPtr) endCallback ) ;
gluTessCallback ( myTesselator, GLU_TESS_ERROR, (TessFuncPtr) errorCallback ) ;
Here’s how I’m creating my display list:
glNewList ( starTrekDisplayList, GL_COMPILE ) ;
gluTessBeginPolygon ( myTesselator, NULL ) ;
gluTessBeginContour ( myTesselator ) ;
gluTessVertex ( myTesselator, starTrek[0], starTrek[0] ) ;
gluTessVertex ( myTesselator, starTrek[1], starTrek[1] ) ;
gluTessVertex ( myTesselator, starTrek[2], starTrek[2] ) ;
gluTessVertex ( myTesselator, starTrek[3], starTrek[3] ) ;
gluTessEndContour ( myTesselator ) ;
gluTessEndPolygon ( myTesselator ) ;
glEndList ( ) ;
And, finally, my display callback:
glClear ( GL_COLOR_BUFFER_BIT ) ;
glCallList ( starTrekDisplayList ) ;
glFlush ( ) ;