View Full Version : Tessellation in VC++/MFC/NT program

11-04-2000, 05:19 PM
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--------------------
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]

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);

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]);

gluTessVertex(tess, inside[0], inside[0]);
gluTessVertex(tess, inside[1], inside[1]);
gluTessVertex(tess, inside[2], inside[2]);


[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.


11-05-2000, 01:42 PM
It appears to me that you haven't added glu32.lib to your project. Go to the project settings menu, linker tab, then add that to the libraries field. You'll want to make sure you do this with all your configurations. (Debug/Release etc.)

11-05-2000, 04:08 PM
I did include glu32.lib in my project settings, for all build configurations.
I double checked again that all my gl files exist in my system where they should exist.
I suspect, though, that my .h,.lib may not be "matching", you know what I mean?
I mean, in addition to what came with my NT, I also installed some from Richard Wright's SuperBible cdrom, and then I'd shuffled them around. Now I am not sure which one goes with what.

Where can I get a set of all the required OpenGL files that are guaranteed to work with each other and for WindowsNT? Please.

Another possibility that I am "hearing" is that OpenGL is not meant to be used in a C++ class, that it should be used in a regular C file? What do you think? How does one do that?

Look forward to your (or anyone's) help again.

Sincerely, JDD.

11-06-2000, 06:28 AM
I've never had any problems using OpenGL in a class myself and don't really see why you would. The errors you are getting are linker errors that basically indicate that the linker cannot find the implementation of those functions.

I wasn't aware that NT came with header and library files for OpenGL. I know it comes with the DLLs. I have always used the OpenGL header and library files that come with VC++ and haven't had any problems.

When you installed the new libraries, I assume you added the paths to those to your list of library paths? You may have moved those paths to the top of the list so that they would be used instead of the ones that come with VC++? If you did, try moving the path to the bottom of the list so it uses the VC++ library instead.