Advertisement
Shishu

fan in visual studio

Mar 29th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <GL/glut.h>
  2.  
  3. float x = 0;
  4. int c = 0;
  5. int m,n,p;
  6.  
  7.  
  8. void single_blade(void)
  9.  
  10. {  
  11.  
  12.    
  13. glColor3f(1,1,1);
  14. glBegin(GL_LINE_LOOP);
  15. glVertex3f(0,0,0);
  16. glVertex3f(.1,.05,0);
  17. glVertex3f(.1,.1,0);
  18. glVertex3f(.2,.2,0);
  19. glVertex3f(.2,.25,0);
  20. glVertex3f(.1,.25,0);
  21. glVertex3f(.25,.35,0);
  22. glVertex3f(.2,.35,0);
  23. glVertex3f(.3,.45,0);
  24. glVertex3f(.25,.45,0);
  25. glVertex3f(.4,.55,0);
  26. glVertex3f(.3,.55,0);
  27. glVertex3f(-.3,.55,0);
  28. glVertex3f(-.4,.55,0);
  29. glVertex3f(-.25,.45,0);
  30. glVertex3f(-.3,.45,0);
  31. glVertex3f(-.2,.35,0);
  32. glVertex3f(-.25,.35,0);
  33. glVertex3f(-.1,.25,0);
  34. glVertex3f(-.2,.25,0);
  35. glVertex3f(-.2,.2,0);
  36. glVertex3f(-.1,.1,0);
  37. glVertex3f(-.1,.05,0);
  38. glVertex3f(0,0,0);
  39. glEnd();
  40.  
  41. }
  42.  
  43. void full_fan(void)
  44. {
  45.  
  46.    
  47.  
  48. }
  49.  
  50.  
  51. void display(void)
  52.  
  53. {
  54.    
  55.     glClearColor(0.0, 0.0, 0.0, 1.0);
  56.     glClear(GL_COLOR_BUFFER_BIT);
  57.     glLoadIdentity();
  58.     gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
  59.     single_blade();
  60.  
  61. glRotatef(90,0,0,1);
  62. single_blade();
  63.  
  64. glRotatef(180,0,0,1);
  65. single_blade();
  66.  
  67. glRotatef(270,0,0,1);
  68. single_blade();
  69.     glFlush();
  70.  
  71.  
  72. //find a way to make 4 projections of the complete fan in four different corner of the screen.
  73.    
  74.  
  75.    
  76.  
  77. }
  78.  
  79. void reshape(int w, int h) {
  80.  
  81.     glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  82.     glMatrixMode(GL_PROJECTION);
  83.     glLoadIdentity();
  84.     gluPerspective(30, 1, 1.0, 100.0);
  85.     glMatrixMode(GL_MODELVIEW);
  86. }
  87.  
  88. int main(int argc, char **argv) {
  89.     glutInit(&argc, argv);
  90.     glutInitDisplayMode(GLUT_SINGLE); // single buffering.. (double buffering for animation)
  91.                                       // full screen is 1000,1000
  92.                                       // this 0,0 or 1000,1000 are world co ordinates
  93.     glutInitWindowSize(700, 700);
  94.     glutInitWindowPosition(100, 100);
  95.     glutCreateWindow("A basic OpenGL Window");
  96.     // registering callback functions
  97.     glutDisplayFunc(display);
  98.     glutReshapeFunc(reshape);
  99.     glutIdleFunc(display);
  100.     glutMainLoop();
  101.     return 0;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement