Skip to content

Instantly share code, notes, and snippets.

@ruby0x1
Last active August 29, 2015 14:19
Show Gist options
  • Save ruby0x1/09d65d66380a5b6624c5 to your computer and use it in GitHub Desktop.
Save ruby0x1/09d65d66380a5b6624c5 to your computer and use it in GitHub Desktop.
Write luxe pixels from GL framebuffer as RGB to a raw file
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