Rian_TS

Bangun Dasar Grafika

Jun 3rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <GL/glut.h>
  2. #include <windows.h>
  3. #include <GL/gl.h>
  4. void init (void) {
  5. glClearColor (1.0, 1.0, 1.0, 0.0);
  6. glLineWidth (1.0);
  7. glColor3f (1.0, 0.0, 0.0);
  8. glOrtho (-6,6, -6,6, -6,6);
  9. }
  10. void Display (void) {
  11. glClear (GL_COLOR_BUFFER_BIT);
  12. glBegin (GL_LINES);
  13. glVertex2f (-5.5, 0.0);
  14. glColor3f (1.0, 0.0, 0.0);
  15. glVertex2f (5.5, 0.0);
  16. glEnd ();
  17. glBegin (GL_LINES);
  18. glVertex2f (0.0, -5.5);
  19. glColor3f (1.0, 0.0, 0.0);
  20. glVertex2f (0.0, 5.5);
  21. glEnd ();
  22.  
  23.  
  24. glBegin (GL_LINE_LOOP);
  25. glColor3f (-1.0, 0.0, 0.0);
  26. glVertex2f (1.0, 1.0);
  27. glColor3f (-1.0, 0.0, 0.0);
  28. glVertex2f (4.0, 1.0);
  29. glColor3f (0.0, 1.0, 0.0);
  30. glVertex2f (1.0, 5.0);
  31. glEnd ();
  32. glutSwapBuffers ();
  33. }
  34. int main (int argc, char** argv) {
  35. glutInit (&argc, argv);
  36. glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
  37. glutInitWindowPosition (0, 0);
  38. glutInitWindowSize (1500, 1500);
  39. glutCreateWindow ("Bangun Dasar Grafik (Rian Umri)");
  40. init ();
  41. glutDisplayFunc (Display);
  42. glutMainLoop ();
  43. return 0;
  44. }
Add Comment
Please, Sign In to add comment