mini_gl_fb/examples/wrong_sized_buffer.rs

21 lines
530 B
Rust
Raw Normal View History

2018-07-28 10:15:56 +10:00
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::RG);
// This should panic! We should only be providing two components but we provide 4!
let buffer = vec![[0u8, 50, 128, 255]; 4];
fb.update_buffer(&buffer);
fb.persist();
}