mini_gl_fb/examples/wrong_sized_buffer.rs

24 lines
718 B
Rust
Raw Normal View History

#[macro_use]
2018-07-28 10:15:56 +10:00
extern crate mini_gl_fb;
use mini_gl_fb::BufferFormat;
use mini_gl_fb::glutin::event_loop::EventLoop;
use mini_gl_fb::glutin::dpi::LogicalSize;
2018-07-28 10:15:56 +10:00
fn main() {
let mut event_loop = EventLoop::new();
let mut fb = mini_gl_fb::get_fancy(config! {
window_title: String::from("Hello world!"),
window_size: LogicalSize::new(800.0, 600.0),
buffer_size: Some(LogicalSize::new(2, 2))
}, &event_loop);
2018-07-28 10:15:56 +10:00
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(&mut event_loop);
2018-07-28 10:15:56 +10:00
}