Using the single document of Visual C++ 6.0, I attempted to compile a tessellation example with texturing in CSceneView Class. I am using the Visual C++ 6.0 compiler. When it tries to compile a gluTessCallback(tobj, GLU_TESS_VERTEX,GlVertex ) statement, I get an error :
error C2664: ‘gluTessCallback’ : cannot convert parameter 3 from ‘void (double *)’ to ‘void (__stdcall *)(void)’
None of the functions with this name in scope match the target type
here,“GlVertex” in the statement is a Callback function defined by me. My main functions about it are as follows:
void CSceneView::BuildF16()
{ ¡¡¡
m_unF16BodyList = glGenLists(1);
glNewList( m_unF16BodyList, GL_COMPILE);
GLUtriangulatorObj *tess; //Tesselator object
tess = gluNewTess();
gluTessCallback(tess, GLU_TESS_BEGIN, (void (CALLBACK *)())glBegin);
gluTessCallback(tess, GLU_TESS_END, glEnd);
gluTessCallback(tess, GLU_TESS_VERTEX, GlVertex ); //error statement in compiling
/* Main wing */
glColor3f( 0.8, 0.8, 0.8 );
glNormal3f(0.0, 1.0, 0.0);
gluTessBeginPolygon(tess, NULL);
gluTessBeginContour(tess);
for (i = 0; i < 16; i ++)
gluTessVertex(tess, wing[i], wing[i]);
gluTessEndContour(tess);
gluTessEndPolygon(tess);
glEndList();
¡¡
}
/my Callback function/
void _stdcall CSceneView::GlVertex(GLdouble *xyz)
{
glTexCoord2dv(xyz + 3);
glVertex3dv(xyz);
}
A similar code in the form of OpenGL main() compiles and runs fine using the Visual C++ 6.0 compiler. As follows:
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(792, 573);
glutCreateWindow(“F-16 Using Quadrics and GLU Polygons”);
glutDisplayFunc(Redraw);
glutKeyboardFunc(Keyboard);
glutMouseFunc(Mouse);
glutMotionFunc(Motion);
glutReshapeFunc(Resize);
if (glutDeviceGet(GLUT_HAS_JOYSTICK))
glutJoystickFunc(Joystick, 100);
BuildF16(); //appears error in compiling
glutMainLoop();
return (0);
}
void
BuildF16(void)
{ ¡¡
GLUtriangulatorObj *tess;
tess = gluNewTess();
gluTessCallback(tess, GLU_TESS_BEGIN, glBegin);
gluTessCallback(tess, GLU_TESS_END, glEnd);
gluTessCallback(tess, GLU_TESS_VERTEX, (void (CALLBACK *)())glu_vertex);
¡¡
}
void APIENTRY
glu_vertex(GLdouble *xyz)
{
glTexCoord2dv(xyz + 3);
glVertex3dv(xyz);
}
Has anyone encountered this problem and known why it is? Please help me!