//Simple.cpp - First OpenGL Program
#include <windows.h> //Required for every Windows Program
#include <gl\glut.h> //Required for using the GLUT library
//Perform OpenGL Initialization here
void SetupRC()
{
//Set the background clearing color to blue
glClearColor(0.0f,0.0f,1.0f,1.0f);//设置背景色为蓝色
}
//The drawing callback function
void RenderScene()
{
//Clear the color buffer
glClear(GL_COLOR_BUFFER_BIT);
//Flush the rendering pipeline
glFlush();
}
void main()
{
//Choose the display mode settings
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);//初始化显示模式(单缓冲,RGB)
//Create the Window
glutCreateWindow("Simple");//创建窗口
//Set the RenderScsne function as the display callback
glutDisplayFunc(RenderScene);//绘制回调函数,当窗口需要绘制时,GLUT会调用此函数
//Initialize OpenGL
SetupRC();//初始化OpenGL
//Start the GLUT framework
glutMainLoop();//开始消息循环
}