Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'bundler/setup'
- require 'opengl'
- require 'glut'
- require './opengl_getbitmap'
- include Gl, Glut
- def init
- glClearColor(0, 0, 0, 1)
- end
- def line(x1, y1, x2, y2)
- glBegin(GL_LINES)
- glVertex2d(x1, y1)
- glVertex2d(x2, y2)
- glEnd
- BitMap.gl_capture("./picture/img#{@counter}.bmp")
- glFlush
- @counter += 1
- end
- display = proc do
- @counter = 1
- glClear(GL_COLOR_BUFFER_BIT)
- glColor3f(0, 1, 0)
- -1.step(1, 0.1) do |x|
- line(x, 1, -x, -1)
- end
- end
- glutInit
- glutInitWindowSize(170, 170)
- glutInitWindowPosition(200, 100)
- glutCreateWindow
- glutDisplayFunc(display)
- init
- glutMainLoop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement