mimas::image_mesaoutput< T > Class Template Reference
[Image Output]

Display images using Xlib and OpenGL. More...

#include <image_mesaoutput.h>

Inheritance diagram for mimas::image_mesaoutput< T >:

Inheritance graph
[legend]
Collaboration diagram for mimas::image_mesaoutput< T >:

Collaboration graph
[legend]
List of all members.

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_windowwindow
timer time
int interval

Classes

class  image_window

Detailed Description

template<typename T>
class mimas::image_mesaoutput< T >

Display images using Xlib and OpenGL.

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: https://bugs.freedesktop.org/show_bug.cgi?id=7444

If you experience problems, you may want to try:

    export LIBGL_ALWAYS_INDIRECT=1
    
This disables hardware rendering.

If it works:

If it doesn't:

See also:
mesa_base

Definition at line 58 of file image_mesaoutput.h.


Constructor & Destructor Documentation

template<typename T>
mimas::image_mesaoutput< T >::image_mesaoutput ( x11_display _display,
int  _width = 32,
int  _height = 32 
)

Open X11-window.

Parameters:
_display X11 display.
_width Initial width of drawing area.
_height Initial height of drawing area.


Member Function Documentation

template<typename T>
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.

Parameters:
image The image to write to the sink.

Implements mimas::image_output< T >.

template<typename T>
void mimas::image_mesaoutput< T >::wait ( int  milliSeconds  ) 

Referenced by mimas::operator<<().

template<typename T>
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<<().

template<typename T>
void mimas::image_mesaoutput< T >::pause ( void   ) 

template<typename T>
x11_window_ptr mimas::image_mesaoutput< T >::get_window ( void   )  [inline]

Definition at line 78 of file image_mesaoutput.h.

References mimas::image_mesaoutput< T >::window.


Member Data Documentation

template<typename T>
std::map< Window, image_mesaoutput< T > * > mimas::image_mesaoutput< T >::windows [static]

Definition at line 70 of file image_mesaoutput.h.

template<typename T>
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().

template<typename T>
timer mimas::image_mesaoutput< T >::time [protected]

Definition at line 97 of file image_mesaoutput.h.

template<typename T>
int mimas::image_mesaoutput< T >::interval [protected]

Definition at line 99 of file image_mesaoutput.h.

Referenced by mimas::image_mesaoutput< T >::delay().


The documentation for this class was generated from the following file:
[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:31 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...