0
上周,我在阅读GLUT教程时发现了一些例子,并且一切都很好。GLUT显示桌面的一部分,而不是我的代码
现在,当我重试这些相同的例子时,我得到一个奇怪的行为:我的GLUT窗口显示窗口位置的桌面部分(所以如果GLUT窗口从(100,100)开始并且大小500px乘500px,它显示桌面的起始部分(100,100)和结束部分(600,600))。
我上周测试的以下示例应该在黑色背景上显示一个茶壶。我想知道我的代码是否有问题(因为我不记得更改其中的任何内容),或者如果问题来自库没有正确链接,或者它是我不知道的其他内容。
#include <GL/glut.h>
void displayFunc(void);
int glutWindow;
int main(int argc, char** argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
// define the size
glutInitWindowSize(500,500);
// the position where the window will appear
glutInitWindowPosition(100,100);
glutWindow = glutCreateWindow("UITest");
glClearColor(0.0, 0.0, 0.0, 0.0);
glutDisplayFunc(displayFunc);
glutMainLoop();
return EXIT_SUCCESS;
}
void displayFunc(void){
glClear(GL_COLOR_BUFFER_BIT);
glutWireTeapot(0.5);
}
谢谢,它的工作!不过,我不明白为什么以前没有它。 – 2012-08-06 06:01:29