gl-capture
Library for capturing screenshots in OpenGL.
See examples/basic.rs for a complete example.
let img = unsafe ;
// img.size: (u32, u32)
// img.data: Vec<capture_gl::Rgb>
// Now use e.g. `png` or `image` crate to save the image data to a file
Alternatively, use capture_into() to reuse the same image data, instead
of reallocating on every call.
let mut img = new;
unsafe
// img.size: (u32, u32)
// img.data: Vec<capture_gl::Rgb>
Also supports other formats, e.g. RgbaImageData, BgrImageData, BgraImageData.
When manually using gl::ReadPixels(), instead it is also possible to use
read_pixels() or read_pixels_ptr(), which performs some additional checks
and setup.
let format = Rgb;
let mut data = format.allocate_pixel_data;
unsafe