Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- #include <stdlib.h>
- #include <math.h>
- void display(){
- glClearColor(1,1,1,0);
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1,0,0);
- glBegin(GL_POINTS);
- glPointSize(1);
- GLint i;
- GLfloat theta,r,x,y,pi;
- //upright ball
- theta=0;
- pi=3.141592653589793;
- for(r=3;r>0;r=r-0.1){
- while(theta<=2*pi){
- x=r*cos(theta);
- y=r*sin(theta);
- glVertex2f(x+62,y+63);
- theta=theta+2*pi/1024;
- }
- theta=0;
- }
- glEnd();
- glFlush();
- }
- int main(int argc, char** argv){
- glutInit(&argc,argv);
- glutInitWindowPosition(50,50);
- glutInitWindowSize(640,640);
- glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
- glutCreateWindow("Circle");
- glMatrixMode(GL_PROJECTION);
- gluOrtho2D(0,100,0,100);
- glutDisplayFunc(display);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement