fix potential garbled output

db4
Doug Coleman 2008-11-01 15:48:35 -05:00
parent 8a494a0da4
commit c417f829bd
1 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,8 @@
! Copyright (C) 2008 Doug Coleman, Joe Groff.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays byte-arrays kernel math namespaces
opengl.gl sequences math.vectors ui graphics.bitmap graphics.viewer
models opengl.framebuffers ui.gadgets.worlds ui.gadgets fry ;
models opengl.framebuffers ui.gadgets.worlds ui.gadgets fry alien.syntax ;
IN: cap
: screenshot-array ( world -- byte-array )
@ -9,7 +11,7 @@ IN: cap
: gl-screenshot ( gadget -- byte-array )
[
GL_BACK glReadBuffer
GL_PACK_ALIGNMENT 1 glPixelStorei
GL_PACK_ALIGNMENT 4 glPixelStorei
0 0
] dip
[ dim>> first2 GL_BGR GL_UNSIGNED_BYTE ]
@ -25,7 +27,4 @@ IN: cap
[ screenshot ] dip save-bitmap ;
: screenshot. ( window -- )
[ screenshot <graphics-gadget> ] [ title>> ] bi open-window ;
[ screenshot <graphics-gadget> ] [ title>> ] bi open-window ;