Advertisement
redsees

Untitled

May 4th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #!/usr/bin/env python2
  2.  
  3. try:
  4.     from OpenGL.GLUT import *
  5.     from OpenGL.GLU import *
  6.     from OpenGL.GL import *
  7.     import sys
  8. except ImportError:
  9.     print "[!] Error importing one or more library(ies)\n\n"
  10.     exit(-1)
  11.  
  12. '''
  13. RGB color table:
  14. ****************
  15.  
  16. Red     Green       Blue        Color
  17. ------------------------------------------------------
  18. 0       0       0       Black
  19. 0       0       1       Blue
  20. 0       1       0       Green
  21. 0       1       1       Cyan
  22. 1       0       0       Red
  23. 1       0       1       Magenta
  24. 1       1       0       Yellow
  25. 1       1       1       White
  26.  
  27. '''
  28.  
  29. def MyCustomShape():
  30.     glClear(GL_COLOR_BUFFER_BIT)
  31.    
  32.     # Your Objects to be draw should be put here
  33.    
  34.     glFlush()
  35.  
  36. def main():
  37.     glutInit(sys.argv)
  38.     glutInitDisplayMode( GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH)
  39.     glutInitWindowSize(500,500)
  40.     glutCreateWindow("Lab1 - Submission")
  41.     glClearColor(1.0,1.0,1.0,0.0)
  42.     glMatrixMode(GL_PROJECTION)
  43.     gluOrtho2D(0.0, 200.0, 0.0, 200.0)
  44.     glutDisplayFunc(MyCustomShape)
  45.     glutMainLoop()
  46.  
  47. if __name__ == '__main__':
  48.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement