glutKeyboardFunc(keyboard);函数出错
我写的键盘回调函数
void keyboard(unsigned char key, int x, int y)
{
float step = 10.0;
float angle = 5.0;
switch(key)
{
case 27:
exit(0);
break;
case 'w':
// move forward: MoveForward(step);
glutPostRedisplay();
break;
case 's':
// move backward: MoveBackward(step);
glutPostRedisplay();
break;
case 'a':
// move left: MoveLeft(step);
glutPostRedisplay();
break;
case 'd':
// move right: MoveRight(step);
glutPostRedisplay();
break;
case 'r':
// move up: MoveUp(step);
glutPostRedisplay();
break;
case 'f':
// move down: MoveDown(step);
glutPostRedisplay();
break;
case 'q':
// roll left: RollLeft(angle);
glutPostRedisplay();
break;
case 'e':
// roll right: RollRight(angle);
glutPostRedisplay();
break;
case ' ':
/*
cam_type=1-cam_type;
if (cam_type==0) p_cam=&theFPCam;
else p_cam=&theFreeCam;
p_cam->SetPosition(CVector3D(500.0, 0.0, 100.0));
p_cam->SetAxes(CVector3D(0,1,0), CVector3D(0,0,1), CVector3D(1,0,0));
*/
glutPostRedisplay();
break;
}
}
调用时使用语句:glutKeyboardFunc(keyboard);
编译时产生错误:error C2664: 'glutKeyboardFunc' : cannot convert parameter 1 from 'void (unsigned char,int,int)' to 'void (__cdecl *)(unsigned char,int,int)'
None of the functions with this name in scope match the target type
OpenGL头文件已添加,void keyboard(unsigned char key, int x, int y)函数也已声明,请问怎么改?