Original Post
I've been working on Drawing a Font using Triangle lists. I got all the points of the font and right now am working on tessellating it. I used the GLUtesselator for tessellating. But right now am getting a linker error for the gluTessCallback functions.The problem is that though am quite comfortable with DirectX am a total newbie to OpenGL. Here's a part of the code :
#include "PathExtruder.h"
#include <gl\glu.h>
using namespace std;
typedef void (__stdcall *GluTessCallbackType)() ;
PathExtruder::PathExtruder(const PathPolygon& pathPolygon)
{
GLUtesselator* tess = 0 ;
UINT nVertNum = 0 ;
int nIndexi, nIndexj, nNumFrontSideVertices, nNumFrontSideTriangles, nFirstContourVertex ;
int nIndexOfThisPt, nIndexOfNextPt ;
tess = gluNewTess() ; // create tesselation object
if(tess == NULL)
{
MessageBox(0, TEXT("Creation of tesselation obj failed"), 0, 0) ;
return ;
}
// register tesselation callbacks
gluTessCallback(tess, GLU_TESS_BEGIN_DATA, reinterpret_cast<GluTessCallbackType>(BeginCB)) ;
gluTessCallback(tess, GLU_TESS_EDGE_FLAG_DATA, reinterpret_cast<GluTessCallbackType>(EdgeFlagCB)) ;
gluTessCallback(tess, GLU_TESS_VERTEX_DATA, reinterpret_cast<GluTessCallbackType>(VertexCB)) ;
gluTessCallback(tess, GLU_TESS_END_DATA, reinterpret_cast<GluTessCallbackType>(EndCB)) ;
gluTessCallback(tess, GLU_TESS_COMBINE_DATA, reinterpret_cast<GluTessCallbackType>(CombineCB)) ;
gluTessCallback(tess, GLU_TESS_ERROR_DATA, reinterpret_cast<GluTessCallbackType>(ErrorCB)) ;
gluTessBeginPolygon(tess, reinterpret_cast<void*>(this)) ; // begin polygon
Vertices << pathPolygon ; // copy the points in the path polygon to the vertex vector
for (nIndexi=0;nIndexi<pathPolygon.size();nIndexi++) // go through the contours
{
gluTessBeginContour(tess) ;
const Contour& r_contour = pathPolygon[nIndexi] ; // store reference to contour
for (nIndexj=0;nIndexj<r_contour.size();nIndexj++) // go through the points in the contour
{
// pass the corresponding vertex to the tesselator object
gluTessVertex(tess, reinterpret_cast<double*>(&Vertices[nVertNum]), reinterpret_cast<void*>(nVertNum)) ;
nVertNum++ ;
}
gluTessEndContour(tess) ;
}
gluTessEndPolygon(tess) ; // end polygon
gluDeleteTess(tess) ; // destroy the tesselation object
tess = 0 ;
}
void __stdcall PathExtruder::BeginCB(GLenum type, PathExtruder* caller)
{
if (type != GL_TRIANGLES)
{
}
}
void __stdcall PathExtruder::EdgeFlagCB(GLboolean flag, PathExtruder* caller)
{
}
void __stdcall PathExtruder::VertexCB(unsigned int vertexIndex, PathExtruder* caller)
{
caller->Indices.push_back(vertexIndex);
}
void __stdcall PathExtruder::EndCB(PathExtruder* caller)
{
}
void __stdcall PathExtruder::CombineCB(GLdouble coords[3], UINT vertexData[4], GLfloat weight[4],
UINT* outData, PathExtruder* caller)
{
// create a new vertex with the given coordinates
Vertex newVertex ;
newVertex.m_dx = coords[0] ;
newVertex.m_dy = coords[1] ;
newVertex.m_dz = coords[2] ;
const Vertex& vert0 = caller->Vertices[vertexData[0]] ;
const Vertex& vert1 = caller->Vertices[vertexData[1]] ;
const Vertex& vert2 = caller->Vertices[vertexData[2]] ;
const Vertex& vert3 = caller->Vertices[vertexData[3]] ;
newVertex.m_du = vert0.m_du * weight[0] + vert1.m_du * weight[1] + vert2.m_du * weight[2] + vert3.m_du * weight[3] ;
newVertex.m_dv = vert0.m_dv * weight[0] + vert1.m_dv * weight[1] + vert2.m_dv * weight[2] + vert3.m_dv * weight[3];
caller->Vertices.push_back(newVertex) ; // add the vertex to the calling object's vertex vector
*outData = caller->Vertices.size() - 1 ; // pass back the index of the new vertex
}
void __stdcall PathExtruder::ErrorCB(GLenum errno, PathExtruder* caller)
{
}
This is the linker error I got : Error 18 error LNK2019: unresolved external symbol _gluDeleteTess@4 referenced in function "public: __thiscall PathExtruder::PathExtruder(class PathPolygon const &)" (??0PathExtruder@@QAE@ABVPathPolygon@@@Z) PathExtruder.obj Help from any quaters will be deeply appreciated