Hi,
I am starting to use tessellation in my VC++/MFC/NT application program. When trying to setup tessellation in a C++ class, say, the applications Doc class. I get the following error when compiling:
[error message]
/*
--------------------Configuration: ACMP - Win32 Debug--------------------
Compiling…
ACMPDoc.cpp
Linking…
ACMPDoc.obj : error LNK2001: unresolved external symbol _gluTessEndPolygon@4
ACMPDoc.obj : error LNK2001: unresolved external symbol _gluTessEndContour@4
ACMPDoc.obj : error LNK2001: unresolved external symbol _gluTessBeginContour@4
ACMPDoc.obj : error LNK2001: unresolved external symbol _gluTessBeginPolygon@8
Debug/ACMP.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
ACMP.exe - 5 error(s), 0 warning(s)
*/
[end of error message]
[codes]
My codes are basically as follows:
///these are vertices for the tess polygon.
static GLdouble outside[7][3] =
{
{ 0.0, 1.0, 0.0 },
{ -0.5, -1.0, 0.0 },
{ -0.4, -1.0, 0.0 },
{ -0.2, -0.1, 0.0 },
{ 0.2, -0.1, 0.0 },
{ 0.4, -1.0, 0.0 },
{ 0.5, -1.0, 0.0 }
};
static GLdouble inside[3][3] =
{
{ 0.0, 0.6, 0.0 },
{ -0.1, 0.1, 0.0 },
{ 0.1, 0.1, 0.0 }
};
GLUtesselator *tess;
tess = gluNewTess();
typedef void (__stdcall * TessFuncPtr)( );
gluTessCallback(tess, GLU_TESS_BEGIN, (TessFuncPtr)glBegin);
gluTessCallback(tess, GLU_TESS_END, (TessFuncPtr)glEnd);
gluTessCallback(tess, GLU_TESS_VERTEX, (TessFuncPtr)glVertex3dv);
gluTessBeginPolygon(tess, (GLvoid *)0);
gluTessBeginContour(tess);
gluTessVertex(tess, outside[0], outside[0]);
gluTessVertex(tess, outside[1], outside[1]);
gluTessVertex(tess, outside[2], outside[2]);
gluTessVertex(tess, outside[3], outside[3]);
gluTessVertex(tess, outside[4], outside[4]);
gluTessVertex(tess, outside[5], outside[5]);
gluTessVertex(tess, outside[6], outside[6]);
gluTessEndContour(tess);
gluTessBeginContour(tess);
gluTessVertex(tess, inside[0], inside[0]);
gluTessVertex(tess, inside[1], inside[1]);
gluTessVertex(tess, inside[2], inside[2]);
gluTessEndContour(tess);
gluTessEndPolygon(tess);
gluDeleteTess(tess);
[end of codes]
Which is basically straight from the example from Richard Wright’s OpenGL SuperBible (well, similar; the ‘Bible’ did tell me I need the type cast for the 3rd parameter in the tess callback function, which took me a looong time to find out. anyhow…).
I would appreciate any feedback, advice, at all. Thanks. Hope to get replies soon.
//jdd