Last active
May 6, 2016 07:35
-
-
Save obelisk68/df2498e8661c086895fb874f1b1943e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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