Make printing less noisy and also fix UV
Getty Ritter
7 years ago
| 14 | 14 | use graphics::vertices::V2D; |
| 15 | 15 | |
| 16 | 16 | static TILE_DATA: [V2D; 4] = [ |
| 17 | V2D { x: 0.5, y: -0.5, u: 1.0, v: 0.0 }, | |
| 18 | V2D { x: -0.5, y: -0.5, u: 0.0, v: 0.0 }, | |
| 19 | V2D { x: 0.5, y: 0.5, u: 1.0, v: 1.0 }, | |
| 20 | V2D { x: -0.5, y: 0.5, u: 0.0, v: 1.0 }, | |
| 17 | V2D { x: 0.5, y: -0.5, u: 1.0, v: 1.0 }, | |
| 18 | V2D { x: -0.5, y: -0.5, u: 0.0, v: 1.0 }, | |
| 19 | V2D { x: 0.5, y: 0.5, u: 1.0, v: 0.0 }, | |
| 20 | V2D { x: -0.5, y: 0.5, u: 0.0, v: 0.0 }, | |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | 23 | // Shader sources |
| 43 | 43 | |
| 44 | 44 | void main() { |
| 45 | 45 | out_color = texture(tex, t_uv); |
| 46 | // out_color = vec4(1.0 - t_uv.x, 1.0 - t_uv.y, 1.0, 1.0); | |
| 47 | 46 | }"; |
| 48 | 47 | |
| 49 | 48 | pub fn main_loop() -> Result<(), pan::Error> { |
| 50 | 49 | let mut f = std::fs::File::open("sample.png").unwrap(); |
| 51 | 50 | let texture: imagefmt::Image<u8> = imagefmt::png::read(&mut f, imagefmt::ColFmt::RGBA).unwrap(); |
| 52 | println!("{:#?}", texture); | |
| 53 | 51 | |
| 54 | 52 | let window = pan::Window::create()?; |
| 55 | 53 | |
| 83 | 81 | .. |
| 84 | 82 | }, |
| 85 | 83 | .. |
| 86 |
} |
|
| 84 | } if k.state == glutin::ElementState::Pressed => { | |
| 87 | 85 | match k.virtual_keycode { |
| 88 | 86 | Some(VirtualKeyCode::Q) => |
| 89 | 87 | return ControlFlow::Break, |
| 90 |
|
|
| 88 | Some(c) => println!("pressed {:#?}", c), | |
| 89 | _ => (), | |
| 91 | 90 | } |
| 92 | 91 | } |
| 93 | 92 | _ => (), |