Advertisement
Guest User

Untitled

a guest
May 6th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. require 'bundler/setup'
  2. require 'opengl'
  3. require 'glut'
  4. require './opengl_getbitmap'
  5. include Gl, Glut
  6.  
  7. def init
  8. glClearColor(0, 0, 0, 1)
  9. end
  10.  
  11. def line(x1, y1, x2, y2)
  12. glBegin(GL_LINES)
  13. glVertex2d(x1, y1)
  14. glVertex2d(x2, y2)
  15. glEnd
  16. BitMap.gl_capture("./picture/img#{@counter}.bmp")
  17. glFlush
  18. @counter += 1
  19. end
  20.  
  21. display = proc do
  22. @counter = 1
  23. glClear(GL_COLOR_BUFFER_BIT)
  24. glColor3f(0, 1, 0)
  25. -1.step(1, 0.1) do |x|
  26. line(x, 1, -x, -1)
  27. end
  28. end
  29.  
  30. glutInit
  31. glutInitWindowSize(170, 170)
  32. glutInitWindowPosition(200, 100)
  33. glutCreateWindow
  34. glutDisplayFunc(display)
  35. init
  36. glutMainLoop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement