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)函数也已声明,请问怎么改?
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)函数也已声明,请问怎么改?
...全文
相关推荐
openGL glut库 方便使用
为你的渲染函数 glutReshapeFunc(reshape); // reshape为窗口大小改变的回调函数 glutKeyboardFunc(keyboard); // keyboard为键盘事件的回调函数
一个Opengl的配置文件1123434435465421
(keyboard);```在你的压缩包文件列表中,"freeglut"可能包含了freeglut的源码、库文件或者预编译的二进制文件。
GLUT Callback
(*func)(int width, int height));```##### 注册键盘回调函数```cvoid glutKeyboardFunc(void(*func)(unsigned char
利用c++实现ANSYS有限元分析结果的可视化
glutMouseFunc(mouse);glutKeyboardFunc(keyboard);```通过上述步骤,我们可以成功地使用C++将ANSYS的有限元分析结果转换为交互式的三维可视化模型。
OpenGL实现贝塞尔曲线或曲面
display); glutReshapeFunc(reshape); glutKeyboardFunc (keyboard); glutMainLoop(); return 0;}```这段代码定义了一个贝塞尔曲线


图形处理/算法

