Advertisement
Guest User

nigu

a guest
Feb 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <GL/glut.h>
  2. void myDisplay(){
  3. glClearColor(0, 0, 0, 1);
  4. glClear(GL_COLOR_BUFFER_BIT);
  5.  
  6. glBegin(GL_LINES);
  7. glColor3f(1,0,0);
  8. glVertex2f(0, 0);
  9. glVertex2f(-10, 0);
  10. glEnd();
  11.  
  12. glBegin(GL_LINES);
  13. glColor3f(0,1,1);
  14. glVertex2f(0,0);
  15. glVertex2f(0,-10);
  16. glEnd();
  17.  
  18. glBegin(GL_LINES);
  19. glColor3f(1,0,1);
  20. glVertex2f(0,0);
  21. glVertex2f(10,0);
  22. glEnd();
  23.  
  24. glBegin(GL_LINES);
  25. glColor3f(0,1,-1);
  26. glVertex2f(0,0);
  27. glVertex2f(0,10);
  28. glEnd();
  29.  
  30. glBegin(GL_LINES);
  31. glColor3f(-1,1,0);
  32. glVertex2f(0.5,-0.5);
  33. glVertex2f(0.5,0.5);
  34. glEnd();
  35.  
  36. glBegin(GL_LINES);
  37. glColor3f(0,-1,1);
  38. glVertex2f(-0.5,-0.5);
  39. glVertex2f(-0.5,0.5);
  40. glEnd();
  41.  
  42. glBegin(GL_LINES);
  43. glColor3f(1,-1,0);
  44. glVertex2f(-0.5,0.5);
  45. glVertex2f(0.5,0.5);
  46. glEnd();
  47.  
  48. glBegin(GL_LINES);
  49. glColor3f(-1,1,0);
  50. glVertex2f(-0.5,-0.5);
  51. glVertex2f(0.5,-0.5);
  52. glEnd();
  53.  
  54. glutSwapBuffers();
  55. }
  56.  
  57. int main(int* argc, char**argv){
  58. glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
  59. glutInitWindowSize(500, 500);
  60. glutInitWindowPosition(0, 0);
  61. glutCreateWindow("First Open GL");
  62. glutDisplayFunc(myDisplay);
  63. glutMainLoop();
  64. return 0;
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement