Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <GL/GL.h>
  3. #include <GL/GLU.h>
  4. #include <GL/glut.h>
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. void reshape(int w, int h)
  10. {
  11. glViewport(0, 0, w, h);
  12. glMatrixMode(GL_PROJECTION);
  13. glLoadIdentity();
  14. gluOrtho2D(-1, 1, -1, 1);
  15. glMatrixMode(GL_MODELVIEW);
  16. }
  17.  
  18. float a[2] = {-1.0f, 0.0f};
  19. float b[2] = {0.5f, 0.0f};
  20. float c[2] = {0.5f, 1.0f};
  21.  
  22. void draw(void)
  23. {
  24. glClear(GL_COLOR_BUFFER_BIT);
  25. glColor3f(0.0f, 0.0f, 1.0f);
  26. glBegin(GL_TRIANGLES);
  27. glVertex2d(a[0],a[1]);
  28. glVertex2d(b[0],b[1]);
  29. glVertex2d(c[0],c[1]);
  30. glEnd();
  31. glFlush();
  32. }
  33.  
  34. int main(int argc, char *argv[])
  35. {
  36. glutInit(&argc, argv);
  37. glutInitWindowSize(400,300);
  38. glutInitWindowPosition(100,100);
  39. glutInitDisplayMode(GLUT_RGB);
  40. glutCreateWindow("Warsztaty 1");
  41. glutReshapeFunc(reshape);
  42. glutDisplayFunc(draw);
  43. glClearColor(0, 0, 0, 0);
  44. glutMainLoop();
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement