#include "stdafx.h"
#include <GL/glut.h>
void init(void)
{
glClearColor(0,0,0,0);
}
void reshape(int w,int h )
{
glViewport(0,0,10,10);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
}
void myDisplay()
{
glColor3f(1.0,1.0,1.0);
glBegin(GL_LINE_LOOP);
glVertex3f(0.0,0.0,0.0);
glVertex3f(-1.0,0.0,0.0);
glVertex3f(1.0,-1.0,0.0);
glVertex3f(0.0,-1.0,0.0);
glEnd;
glFlush;
}
int _tmain(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(400, 400);
glutCreateWindow("第一个OpenGL程序");
glutDisplayFunc(myDisplay);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
那为什么是白屏的呢?我的colorclear明明是黑色的。。。。