void drawCricle(float r, int x, int y)
{
for (float i = 0; i < 360; i += 0.01)
{
glColor3f(rand() % 200 + 40, rand() % 254, rand() % 200 + 40);//随机颜色
glVertex2f(r*cos(i*3.14159 / 180.0), r*sin(i*3.14159 / 180.0));//计算xy坐标
}
}
void Render(void)
{
int a = clock();
glClear(GL_COLOR_BUFFER_BIT);
glPointSize(1);
glColor3f(0, 1.0, 0);
glBegin(GL_POINTS);
drawCricle(0.9, 0, 0);
glEnd();
glFlush();
cout << "FPS:" << 1000.0 / (clock() - a) << endl;
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
glutInitWindowSize(640, 640);
glutCreateWindow("OpenGL");
glutDisplayFunc(Render);
glutMainLoop();
return 0;
}