1 use gpu_display::GpuDisplay;
2 
main()3 fn main() {
4     let mut disp = GpuDisplay::open_x(None::<&str>).unwrap();
5     let surface_id = disp.create_surface(None, 1280, 1024).unwrap();
6 
7     let mem = disp.framebuffer(surface_id).unwrap();
8     for y in 0..1024 {
9         let mut row = [0u32; 1280];
10         for (x, item) in row.iter_mut().enumerate() {
11             let b = ((x as f32 / 1280.0) * 256.0) as u32;
12             let g = ((y as f32 / 1024.0) * 256.0) as u32;
13             *item = b | (g << 8);
14         }
15         mem.as_volatile_slice()
16             .offset(1280 * 4 * y)
17             .unwrap()
18             .copy_from(&row);
19     }
20     disp.flip(surface_id);
21 
22     while !disp.close_requested(surface_id) {
23         disp.dispatch_events();
24     }
25 }
26