Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include "stdafx.h"
  2.  
  3. #define _USE_MATH_DEFINES
  4. #include <math.h>
  5. #include <glut.h>
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. float* X;
  10. float* Y;
  11. void osi() {
  12. glClear(GL_COLOR_BUFFER_BIT); //очистим цвета в glClearColor
  13. glBegin(GL_LINES);
  14. glColor3f(0.0, 0.0, 0.0);
  15.  
  16. glVertex2i(-600, 0);
  17. glVertex2i(600, 0);
  18.  
  19. glVertex2i(0, -600);
  20. glVertex2i(0, 600);
  21. glEnd();
  22.  
  23.  
  24.  
  25. glBegin(GL_LINE_STRIP);
  26. //glColor3f(0.4, 0.7, 0.7);
  27. for (float x = -600; x <= 600; x++) {
  28. float y =100* x*x;
  29. glVertex2f(x, y);
  30. }
  31. glEnd();
  32. glFlush();
  33. }
  34.  
  35.  
  36.  
  37. int main(int argc, char **argv) {
  38. glutInit(&argc, argv);
  39. glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  40. glutInitWindowSize(600, 400);
  41. glutCreateWindow("GRAFIC");
  42. glClearColor(1.0, 1.0, 1.0, 1.0);
  43. glOrtho(-600.0, 600.0, -600.0,600.0, -0.5, 0.5);
  44. glutDisplayFunc(osi);
  45. glutMainLoop();
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement