Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <GL/glut.h>
- #include <stdlib.h>
- #include <math.h>
- void init()
- {
- glClearColor(0.0f,128.0f,0.0f,0.0f);
- glOrtho(-15,15,-15,15,-15,5);
- }
- void circle(GLfloat rx,GLfloat ry,GLfloat cx,GLfloat cy)
- {
- glBegin(GL_TRIANGLE_FAN);
- glVertex2f(cx,cy);
- for(int i=0;i<=100;i++)
- {
- float angle= 2.0f *3.1416f*i/100;
- float x = rx *cosf(angle);
- float y = ry * sinf(angle);
- glVertex2f((x+cx),(y+cy));
- }
- glEnd();
- }
- void myDisplay()
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(255.0f,0.0f,0.0f);
- circle(3,3,0,0);
- glFlush();
- }
- int main()
- {
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RED) ;
- glutInitWindowSize(600,600);
- glutInitWindowPosition(200,200);
- glutCreateWindow("Lab Task Circle");
- init();
- glutDisplayFunc(myDisplay);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment