madzik4113

GRAFIKA zajecia2 RYSUNEK2

Mar 19th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <GL\glut.h>
  3. #include <math.h>
  4. using namespace std;
  5. #define PI 3.14159265
  6.  
  7. void rysunek2(float r, float kat)
  8. {
  9. float rozmiar=360/kat;
  10. float przyrost = kat;
  11.  
  12. glBegin(GL_LINES);
  13. glColor3f(1,0,0);
  14. for(int i=0;i<rozmiar;i++)
  15. {
  16.  
  17. glVertex3f(r*cos(kat),r*sin(kat),0);
  18. kat+=3.6;
  19. glVertex3f(r*cos(kat),r*sin(kat),0);
  20.  
  21.  
  22. }
  23. glEnd();
  24.  
  25. }
  26. void Display()
  27. {
  28.  
  29. glClearColor(0,0,0,0);
  30. glClear(GL_COLOR_BUFFER_BIT);
  31. rysunek2(0.8,3.6);
  32. glFlush();
  33. glutSwapBuffers();
  34. }
  35.  
  36. int _tmain(int argc, char* argv[])
  37. {
  38. glutInit( &argc, argv);
  39. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
  40. glutInitWindowPosition(190,100);
  41. glutInitWindowSize(600 ,600);
  42. glutCreateWindow("lekcja2");
  43. glutDisplayFunc(Display);
  44. glMatrixMode(GL_PROJECTION);
  45. glutMainLoop();
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment