【发布时间】:2011-12-11 11:12:49
【问题描述】:
我已经尝试使用this tutorial 开始使用 OpenGL 进行编程,并且目前拥有以下代码:
#include <gl/glut.h> // Include the GLUT header file
void display (void)
{
}
int main(int argc, char **argv)
{
glutInit(&argc, argv); // Initialize GLUT
// Set up a basic display buffer (only single buffered for now)
glutInitDisplayMode (GLUT_SINGLE);
glutInitWindowSize (500, 500); // Set the width and height of the window
glutInitWindowPosition (100, 100); // Set the position of the window
// Set the title for the window
glutCreateWindow("Your first OpenGL Window!");
glutDisplayFunc(display);
glutMainLoop();
glClearColor(1.f, 0.f, 0.f, 1.f); // Clear the background of our window to red
return 0;
}
我在 Eclipse 中构建并运行该项目,它编译一切正常,但没有任何反应(没有弹出窗口或任何东西)。谁能告诉我我做错了什么?
【问题讨论】:
-
添加打印语句以确保您的代码实际运行。