Skip to content

Instantly share code, notes, and snippets.

@obelisk68
Last active May 6, 2016 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obelisk68/df2498e8661c086895fb874f1b1943e2 to your computer and use it in GitHub Desktop.
Save obelisk68/df2498e8661c086895fb874f1b1943e2 to your computer and use it in GitHub Desktop.
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
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)
BitMap.gl_capture("./picture/img#{@counter}.bmp")
glFlush
@counter += 1
end
end
glutInit
glutInitWindowSize(170, 170)
glutInitWindowPosition(200, 100)
glutCreateWindow
glutDisplayFunc(display)
init
glutMainLoop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment