Code:
GLdouble rec1[3] = {0.0, 0.0, 0.0};
GLdouble rec2[3] = {250.0, 0.0, 0.0};
GLdouble rec3[3] = {250.0, 65.0, 0.0};
GLdouble rec4[3] = {0.0, 65.0, 0.0};
GLdouble win1[3] = {5.0, 5.0, 0.0};
GLdouble win2[3] = {25.0, 5.0, 0.0};
GLdouble win3[3] = {25.0, 25.0, 0.0};
GLdouble win4[3] = {5.0, 25.0, 0};
GLdouble* outer[4] = {rec1, rec2, rec3, rec4};
GLdouble* inner[4] = {win1, win2, win3, win4};
GLvoid tcbBegin(GLenum type)
{
glBegin(type);
}
GLvoid tcbVertex(GLvoid *vertex)
{
glVertex3dv((GLdouble*)vertex);
}
GLvoid tcbEnd()
{
glEnd();
}
GLvoid combineCallback(GLdouble coords[3], GLdouble *vertex_data[4], GLfloat weight[4], GLdouble **dataOut )
{
GLdouble *vertex;
vertex = (GLdouble *) malloc(3 * sizeof(GLdouble));
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
*dataOut = vertex;
}
GLvoid errorCallback(GLenum errorCode)
{
const GLubyte *estring;
estring = gluErrorString(errorCode);
fprintf(stderr, "Tessellation Error: %s\n", estring);
}
//init()
wall1 = gluNewTess();
gluTessCallback(wall1, GLU_TESS_VERTEX, (GLvoid)tcbVertex);
gluTessCallback(wall1, GLU_TESS_BEGIN, (GLvoid)tcbBegin);
gluTessCallback(wall1, GLU_TESS_END, (GLvoid)tcbEnd);
gluTessCallback(wall1, GLU_TESS_COMBINE, (GLvoid)combineCallback);
gluTessCallback(wall1, GLU_TESS_ERROR, (GLvoid)errorCallback);
glShadeModel(GL_FLAT);
//display()
gluTessNormal(wall1, 0.0, 0.0, 1.0);
gluTessProperty(wall1, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
gluTessBeginPolygon(wall1, NULL);
gluTessBeginContour(wall1);
for (int i = 0; i < 4; i++)
gluTessVertex(wall1, outer[i], outer[i]);
gluTessEndContour(wall1);
gluTessBeginContour(wall1);
for (int i = 0; i < 4; i++)
gluTessVertex(wall1, inner[i], inner[i]);
gluTessEndContour(wall1);
gluTessEndPolygon(wall1);
I suspect it has something to do with the (GLvoid) casts I have to add to the gluTessCallBack function parameters to eliminate the compile errors. Specifically: