| 1 | /* |
| 2 | This file is part of the CVD Library. |
| 3 | |
| 4 | Copyright (C) 2005 The Authors |
| 5 | |
| 6 | This library is free software, see LICENSE file for details |
| 7 | */ |
| 8 | |
| 9 | #include <cvd/gl_helpers.h> |
| 10 | #include <cvd/image_io.h> |
| 11 | #include <cvd/videodisplay.h> |
| 12 | |
| 13 | #include <iostream> |
| 14 | |
| 15 | using namespace CVD; |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | try |
| 20 | { |
| 21 | Image<Rgb<byte>> i = img_load(std::cin); |
| 22 | |
| 23 | VideoDisplay d(i.size()); |
| 24 | |
| 25 | d.select_events(ExposureMask | KeyPressMask); |
| 26 | |
| 27 | for(;;) |
| 28 | { |
| 29 | glDrawPixels(i); |
| 30 | glFlush(); |
| 31 | |
| 32 | XEvent e; |
| 33 | d.get_event(&e); |
| 34 | |
| 35 | if(e.type == KeyPress) |
| 36 | return 0; |
| 37 | } |
| 38 | } |
| 39 | catch(const Exceptions::All& a) |
| 40 | { |
| 41 | std::cerr << "Error: " << a.what() << std::endl; |
| 42 | } |
| 43 | } |