mirror of
https://github.com/italicsjenga/mini_gl_fb.git
synced 2024-11-22 07:21:30 +11:00
Add example for black and white
This commit is contained in:
parent
de363927dd
commit
32c6a5ce09
20
examples/black_and_white.rs
Normal file
20
examples/black_and_white.rs
Normal file
|
@ -0,0 +1,20 @@
|
|||
extern crate mini_gl_fb;
|
||||
|
||||
use mini_gl_fb::{Config, BufferFormat};
|
||||
|
||||
fn main() {
|
||||
let mut fb = mini_gl_fb::get_fancy(Config {
|
||||
window_title: "Hello world!",
|
||||
window_size: (800.0, 600.0),
|
||||
buffer_size: (2, 2),
|
||||
.. Default::default()
|
||||
});
|
||||
|
||||
fb.change_buffer_format::<u8>(BufferFormat::R);
|
||||
fb.use_grayscale_shader();
|
||||
|
||||
let buffer = [128u8, 255, 50, 25];
|
||||
fb.update_buffer(&buffer);
|
||||
|
||||
fb.persist_and_redraw(true);
|
||||
}
|
Loading…
Reference in a new issue