#include <image_mesaoutput.h>
Inheritance diagram for mimas::image_mesaoutput< T >:
Public Member Functions | |
image_mesaoutput (x11_display *_display, int _width=32, int _height=32) | |
Open X11-window. | |
virtual void | write (const const_image_ref< T > &image) |
Write image to arbitrary sink. | |
void | wait (int milliSeconds) |
void | delay (int milliSeconds) |
void | pause (void) |
x11_window_ptr | get_window (void) |
Static Public Attributes | |
static std::map< Window, image_mesaoutput< T > * > | windows |
Protected Attributes | |
boost::shared_ptr< image_window > | window |
timer | time |
int | interval |
Classes | |
class | image_window |
Displaying images with this class may not work properly, if another part of the program is consuming X11-events.
Do not forget to initialise glut at the beginning of your program:
glutInit( &argc, argv );
Objects of this class must be working on a single display.
This class is not thread-safe.
The following example demonstrates loading and displaying an image:
#include <fstream> #include <GL/glut.h> #include "image_fileinput.h" #include "image_mesaoutput.h" using namespace std; using namespace mimas; // Minimal program for displaying single image. int main( int argc, char *argv[] ) { int retVal = 0; try { // Initialise GLUT. glutInit( &argc, argv ); // Check command-line. MMERROR( argc == 2, mimasexception, , "Syntax: " << argv[0] << " <image>" ); // Open X11 display. x11_display disp; // Load single image. ifstream f( argv[1], ios::binary ); image< rgba< unsigned char > > img; f >> img; // Display the image. image_mesaoutput< rgba< unsigned char > > win( &disp ); win << img << mimas::pause(); } catch ( exception &e ) { // Print error message. cerr << e.what() << endl; retVal = 1; }; return retVal; }
Xorg 6.9.0 does not display gray images properly (GL_LUMINANCE). A bug report was filed: http://bugs.freedesktop.org/show_bug.cgi?id=7444
If you experience problems, you may want to try:
export LIBGL_ALWAYS_INDIRECT=1
If it works:
If it doesn't:
Definition at line 58 of file image_mesaoutput.h.
mimas::image_mesaoutput< T >::image_mesaoutput | ( | x11_display * | _display, | |
int | _width = 32 , |
|||
int | _height = 32 | |||
) |
Open X11-window.
_display | X11 display. | |
_width | Initial width of drawing area. | |
_height | Initial height of drawing area. |
virtual void mimas::image_mesaoutput< T >::write | ( | const const_image_ref< T > & | image | ) | [virtual] |
Write image to arbitrary sink.
This function is virtual and has to be overriden by the inheriting class.
image | The image to write to the sink. |
Implements mimas::image_output< T >.
void mimas::image_mesaoutput< T >::wait | ( | int | milliSeconds | ) |
Referenced by mimas::operator<<().
void mimas::image_mesaoutput< T >::delay | ( | int | milliSeconds | ) | [inline] |
Definition at line 74 of file image_mesaoutput.h.
References mimas::image_mesaoutput< T >::interval.
Referenced by mimas::operator<<().
void mimas::image_mesaoutput< T >::pause | ( | void | ) |
x11_window_ptr mimas::image_mesaoutput< T >::get_window | ( | void | ) | [inline] |
std::map< Window, image_mesaoutput< T > * > mimas::image_mesaoutput< T >::windows [static] |
Definition at line 70 of file image_mesaoutput.h.
boost::shared_ptr< image_window > mimas::image_mesaoutput< T >::window [protected] |
Definition at line 95 of file image_mesaoutput.h.
Referenced by mimas::image_mesaoutput< T >::get_window().
timer mimas::image_mesaoutput< T >::time [protected] |
Definition at line 97 of file image_mesaoutput.h.
int mimas::image_mesaoutput< T >::interval [protected] |
Definition at line 99 of file image_mesaoutput.h.
Referenced by mimas::image_mesaoutput< T >::delay().