我尝试在Microsoft Visual Studio 2010 Express中运行一些c ++文件。当我调试c ++文件时,它只显示一个空白窗口。代码是从教科书中复制的,它是一个在窗口中绘制线条的简单代码。窗口名称正确,但在窗口内只有一个空白页面。我想也许窗户有问题,我不知道如何解决它。请帮我。我确信代码没有任何问题。这是代码:
#include <glut.h>
void init (void)
{
glClearColor(1.0,1.0,1.0,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0,200.0,0.0,150.0);
}
void lineSegment(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f(0.0,0.4,0.2);
glBegin(GL_LINES);
glVertex2i(180,15);
glVertex2i(10,145);
glEnd();
glFlush();
}
void main(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(50,100);
glutInitWindowSize(400,300);
glutCreateWindow("AAAAA");
init();
glutDisplayFunc(lineSegment);
glutMainLoop();
}