Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #include <glut.h>
  2. #include <cmath>
  3.  
  4. const double pi = 3.1415926535897932384626433832795;
  5. const double r1 = 0.25;
  6. const double r2 = 0.5;
  7. const double base1 = -pi / 2;
  8. const double base2 = pi / 2;
  9.  
  10. void Draw(){
  11. glClear( GL_COLOR_BUFFER_BIT);
  12. glBegin(GL_POLYGON);
  13. glColor3d(1, 1, 0);
  14.  
  15. for(int i = 0; i < 5; i++){
  16. double a1, a2;
  17. a1 = base1 + i * 2 * pi / 5;
  18. a2 = base2 + (i+3) * 2 * pi / 5;
  19. glVertex2d( r1 * cos(a1), r1 * sin(a1) );
  20. glVertex2d( r2 * cos(a2), r2 * sin(a2) );
  21.  
  22.  
  23. }
  24.  
  25. glEnd();
  26. glFlush();
  27. }
  28.  
  29. int main(int argc, char ** argv){
  30. glutInit(&argc, argv);
  31. glutInitDisplayMode(GLUT_SINGLE);
  32. glutInitWindowPosition(100, 100);
  33. glutInitWindowSize(500, 500);
  34. glutCreateWindow( " hello " );
  35. glutDisplayFunc( Draw );
  36. //glEnable(GL_CLIP_PLANE0);
  37. //double eq[] = {-1.8, -1.0, 0.0, 1.4};
  38. //glClipPlane(GL_CLIP_PLANE0, eq );
  39.  
  40. //glEnable(GL_CLIP_PLANE1);
  41. //double eq1[] = {0.5, -0.9, 0.0, 0.2};
  42. //glClipPlane(GL_CLIP_PLANE1, eq1);
  43.  
  44. glutMainLoop();
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement