iamyeasin

circle

Oct 9th, 2019
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #include<windows.h>
  2. #include <GL/glut.h>
  3. #include <GL/gl.h>
  4. #include <bits/stdc++.h>
  5.  
  6. using namespace std;
  7.  
  8. double x1,y11,x2,y2,delx,dely,delm,x,y,pk;
  9.  
  10. void display(void)
  11. {
  12. glClear(GL_COLOR_BUFFER_BIT);
  13. glColor3f(1.0,0.0,0.0);
  14.  
  15. glBegin(GL_POINTS);
  16. glVertex2i(0,y);
  17. glVertex2i(y,0);
  18. glVertex2i(0,-y);
  19. glVertex2i(-y,0);
  20. glVertex2i((y/2.00),(y/2.00));
  21. glVertex2i((y/2.00),-(y/2.00));
  22. glVertex2i(-(y/2.00),(y/2.00));
  23. glVertex2i(-(y/2.00),-(y/2.00));
  24. glEnd();
  25.  
  26. glFlush();
  27.  
  28. }
  29.  
  30. void init(void)
  31. {
  32. glClearColor(1,1,1,5.0);
  33. glMatrixMode(GL_PROJECTION);
  34. // glClear(GL_COLOR_BUFFER_BIT);
  35. glLoadIdentity();
  36. glPointSize(39.0);
  37. glOrtho(-100.0, 100.0, -100.0, 100.0, -100.0, 100.0);
  38.  
  39. }
  40. int main(int a,char **ar)
  41. {
  42. glutInit(&a,ar);
  43. glutInitDisplayMode(GLUT_RED | GLUT_SINGLE);
  44. glutInitWindowPosition(100,100);
  45. glutInitWindowSize(800,500);
  46. glutCreateWindow("Polygon");
  47. cin >> y ;
  48.  
  49. init();
  50. glutDisplayFunc(display);
  51. glutMainLoop();
  52.  
  53. return 0;
  54.  
  55. }
Add Comment
Please, Sign In to add comment