require 'gl' # for gl functions
require 'gtk2' # for gdk-pixbuf functions
[...]
def get_screenshot
gl{}
data = glReadPixels( 0, 0, WIDTH - 1, HEIGHT - 1, GL_RGB, GL_UNSIGNED_BYTE)
screenbuffer = Gdk::Pixbuf.new(data, Gdk::Pixbuf::COLORSPACE_RGB, false, 8, WIDTH - 1, HEIGHT - 1, (WIDTH - 1)* 3)
screenbuffer.flip(false).save("#{$screenshot_path}/scrinshaute_gosu.png", 'png')
end
[...]
require 'gl' # for gl functions
require 'rmagick' # for rmagick functions
[...]
def get_screenshot
gl { data = glReadPixels( 0, 0, WIDTH, HEIGHT, GL_RGB, GL_UNSIGNED_SHORT) }
screenbuffer = Magick::Image.new(WIDTH, HEIGHT);
screenbuffer.import_pixels(0, 0, WIDTH, HEIGHT, "RGB", data, Magick::ShortPixel).flip!
screenbuffer.write("screenshot_gosu.png");
end
end
[...]
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill