Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- #
- require 'rubygems'
- require 'opengl'
- def init
- position = [2, 2, -10, 1]
- ambient = [0.5, 0.5, 0.5, 0.0]
- specular = [0.225, 0.412, 0.667, 0.0]
- spec_reflection = [0.3, 0.3, 0.3, 0.0]
- glClearColor(0.7, 0.7, 0.7, 0.7)
- glEnable(GL_LIGHTING)
- glLight(GL_LIGHT0, GL_POSITION, position)
- glLight(GL_LIGHT0, GL_SPECULAR, specular)
- glMaterial(GL_FRONT, GL_SPECULAR, spec_reflection)
- glMaterial(GL_FRONT, GL_SHININESS, 96)
- glLightModel(GL_LIGHT_MODEL_AMBIENT, ambient)
- glShadeModel(GL_SMOOTH)
- glEnable(GL_COLOR_MATERIAL)
- glEnable(GL_LIGHT0)
- glEnable(GL_DEPTH_TEST)
- end
- display = Proc.new do
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
- color = [0.225, 0.412, 0.667, 0.0]
- glColor(color)
- glutSolidSphere(0.6, 64, 64)
- glutSwapBuffers
- end
- keyboard = Proc.new do |key, x, y|
- case (key)
- when ?\e
- exit(0);
- end
- end
- glutInit
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
- glutInitWindowSize(500, 500)
- glutInitWindowPosition(100, 100)
- glutCreateWindow("Yo Mamma")
- glutDisplayFunc(display)
- glutKeyboardFunc(keyboard)
- init
- glutMainLoop()
Add Comment
Please, Sign In to add comment