C++ OpenGL项目崩溃

C++ OpenGL项目崩溃,c++,opengl,glut,opengl-compat,C++,Opengl,Glut,Opengl Compat,此代码编译时没有错误或警告,但无法运行,应用程序会立即崩溃 #include <GL/glut.h> int WinWidth = 640, WinHeight = 480; int WinFar = 10; void DrawPoint(float x, float y) { glColor3f(1.0, 1.0, 1.0); glBegin(GL_POINTS); glVertex2f(x, y); glEnd(); } void display() {

此代码编译时没有错误或警告,但无法运行,应用程序会立即崩溃

#include <GL/glut.h>

int WinWidth  = 640,
 WinHeight = 480;
int WinFar   = 10;

void DrawPoint(float x, float y)
{
 glColor3f(1.0, 1.0, 1.0);
 glBegin(GL_POINTS);
  glVertex2f(x, y);
 glEnd();
}

void display()
{
 glClear(GL_COLOR_BUFFER_BIT);
 //Draws
 DrawPoint(0, 0);
 //
 glFlush();
}

int main(int argc, char** argv)
{
 glutInit(&argc, argv);
 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
 glutInitWindowSize(WinWidth, WinHeight);
 glutInitWindowPosition(150, 150);
 glutCreateWindow("Lesson 01");
 glClearColor(0, 0, 0, 1.0);

 glOrtho(-WinWidth/2, WinWidth/2, WinHeight/2, -WinHeight/2, -WinFar/2, WinFar/2);
 glutDisplayFunc(display);

 glutMainLoop();
 return 0;
}
#包括
int WinWidth=640,
WinHeight=480;
int-WinFar=10;
无效提取点(浮动x、浮动y)
{
GL3F(1.0,1.0,1.0);
glBegin(总分);
glVertex2f(x,y);
格伦德();
}
无效显示()
{
glClear(GLU颜色缓冲位);
//吸引
提取点(0,0);
//
glFlush();
}
int main(int argc,字符**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
GLUTINITWindowsSize(WinWidth、WinHeight);
位置(150150);
第二课(“第01课”);
glClearColor(0,0,0,1.0);
glOrtho(-WinWidth/2,WinWidth/2,WinHeight/2,-WinHeight/2,-WinFar/2,WinFar/2);
glutDisplayFunc(显示器);
glutMainLoop();
返回0;
}
它正在崩溃,返回值为322225477。我做错了什么

程序接收信号SIGEGV,分段故障
当我在调试模式下运行它时

在调试器中运行时它在哪里崩溃?关于崩溃的更多详细信息,请参阅我已经运行了您的程序,并且它“正常”工作。所以问题是:哪个操作系统、编译器、库版本等等。Windows7、Ide-Devcpp、FreeGLUT3.0。0@OlegPustoslovopenGL版本也很重要