1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include<Windows.h>
#include<GL/GL.H>
#include<GL/GLU.H>
#include<GL/glut.h>
#include<math.h>
void Init()
{
glClearColor(1,0,0,0);
glColor3f(0,0,0);
glPointSize(4);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,640.0,0.0,480.0);
}
void Display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
for(int x=0,y;x<50;++x)
{
y=sqrt(2500.0-pow(x,2.0));
glVertex2i(x,y);
}
glEnd();
glFlush();
}
int main(int &argc,char**argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,150);
glutCreateWindow("Hello World");
glutDisplayFunc(Display);
Init();
glutMainLoop();
return 0;
}
|