Last active
August 29, 2015 14:19
-
-
Save ruby0x1/09d65d66380a5b6624c5 to your computer and use it in GitHub Desktop.
Write luxe pixels from GL framebuffer as RGB to a raw file
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
import snow.api.buffers.Uint8Array; | |
import snow.modules.opengl.GL; | |
//.... | |
override function onkeyup( e:KeyEvent ) { | |
if(e.keycode == Key.key_h) { | |
var w:Int = Std.int(Luxe.screen.w); | |
var h:Int = Std.int(Luxe.screen.h); | |
if(pix == null) pix = new Uint8Array(w * h * 3); | |
GL.readPixels(0, 0, w, h, GL.RGB, GL.UNSIGNED_BYTE, pix); | |
trace('${pix[0]} ${pix[1]} ${pix[2]}'); | |
Luxe.snow.io.data_save('/Users/sven/dev/test.raw', pix); | |
} | |
} //onkeyup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment