glutExitgamemode回调错误
我正在编写一个程序来学习如何使用 opengl 和 glut,但我对 glut 有问题,我不太明白它出了什么问题。
我可以创建一个过剩窗口并进入全屏模式,但是每当我调用过剩游戏模式时,它都会起作用,但是当我退出过剩游戏时,程序崩溃而不是返回到小窗口。
我收到以下错误:
2011-12-10 01:09:43.709 ogl[979:903] GLUT 警告:以下是 GLUT 3.0 的新检查;更新您的代码。
2011-12-10 01:09:43.710 ogl[979:903] GLUT 致命错误:窗口 2 需要重新显示,但没有显示回调。
在调用 glut exit game mode 以使程序正常工作之前我应该做什么?
这是代码片段:
开关(钥匙) { 案例27: 退出(0); 休息; 案例97: glutGameModeString("640x480:32@60"); glutEnterGameMode();
break; 案例99: glutLeaveGameMode(); 案例98: glutFullScreen(); 休息; }
这是我在 main 中的代码:
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(50, 100);
glutInitWindowSize(640,480);
glutCreateWindow("GameMode");
windows = glutGetWindow();
glutReshapeFunc(重塑);
glutDisplayFunc(显示);
glutKeyboardFunc(键句柄);
glutMainLoop(); }
I am writing a program to learn how to use opengl and glut in general and i have have problem with glut that i don't really quite understand what is wrong with it.
I can create a glut window and enter full screen mode just fine, but whenever i make a call to glut game mode, it works, but when i exit glut game, the program crashes rather than returning to a small window.
I get the following errors:
2011-12-10 01:09:43.709 ogl[979:903] GLUT Warning: The following is a new check for GLUT 3.0; update your code.
2011-12-10 01:09:43.710 ogl[979:903] GLUT Fatal Error: redisplay needed for window 2, but no display callback.
What am I suppose to do when before calling glut exit game mode to to make the program work right?
This is a snippet of the code:
switch (key)
{
case 27:
exit(0);
break;
case 97:
glutGameModeString("640x480:32@60");
glutEnterGameMode();
break;
case 99:
glutLeaveGameMode();
case 98:
glutFullScreen();
break;
}
This is my code in main:
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(50, 100);
glutInitWindowSize(640,480);
glutCreateWindow("GameMode");
windows = glutGetWindow();
glutReshapeFunc(Reshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyhandle);
glutMainLoop();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此消息告诉您,GLUT 希望您为其提供一个显示回调函数。 glutDisplayFunc 用于此目的。
无法判断这是否是您的问题,因为您没有提供代码。
This message tells you, that GLUT expects you to give it a display callback function. glutDisplayFunc is used for this.
It's impossible to tell, if, or if not this is your problem, because you didn't provided your code.