Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define GLUT_DISABLE_ATEXIT_HACK
- #include <windows.h>
- #include <gl/glut.h>
- #include <math.h>
- #define PI 3.14159
- #define circlePoints 64
- int i;
- void display()
- {
- GLfloat angleStep=2*PI/(float)circlePoints;
- //Gluint pointPerQuarter=circlePoints/4;
- GLfloat x[circlePoints];
- GLfloat y[circlePoints];
- GLfloat radius=10;
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1,1,1);
- glLineWidth(10);
- for(i=0;i<circlePoints;i++)
- {
- //Define points in first quadrant
- x[i]=5+radius*cos(i*angleStep);
- y[i]=-5+radius*sin(i*angleStep);
- }
- glBegin(GL_LINE_LOOP);
- for (i=0;i<circlePoints;i++)
- {
- glVertex2f(x[i],y[i]);
- }
- glEnd();
- glFlush();
- }
- int main(int argc, char** argv)
- {
- glutInit(&argc,argv);
- glutInitWindowPosition(50,50);
- glutInitWindowSize(640,480);
- glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
- glutCreateWindow("Circle Drawing");
- glMatrixMode(GL_PROJECTION);
- gluOrtho2D(-32,32,-24,24);
- glutDisplayFunc(display);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement