这个程序我怎么不循环啊
#include <stdio.h>
#include <time.h>
#include <windows.h>
#include <gl/glut.h>
void pixel(int x, int y, int size, GLubyte Red, GLubyte Green, GLubyte Blue)
{
glPointSize(size);
glBegin(GL_POINTS);
glColor3ub(Red, Green, Blue);
glVertex2f(x, y);
glEnd();
glFlush();
}
void drawing()
{
int base,x,y;
srand((unsigned)time(NULL));
base=rand()%255+1;
srand((unsigned)time(NULL));
x=rand()%255+1;
srand((unsigned)time(NULL));
y=rand()%255+1;
for(int i=0;i<20000;i++)//这里为什么不循环啊!!郁闷
{
pixel(x, y, i%4, base, base+50, base+20);
}
}
void init_display()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void display()
{
init_display();
drawing();
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLsizei)w, (GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, (GLdouble)w, 0.0, (GLdouble)h);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_SINGLE);
glutInitWindowSize(800, 600);
glutInitWindowPosition(0, 0);
glutCreateWindow("Point");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
display();
glutMainLoop();
return 0;
}