mimas::mesa_base Class Reference

Abstract base class for mesa-functionality. More...

#include <mesa_base.h>

Inheritance diagram for mimas::mesa_base:

Inheritance graph
[legend]
Collaboration diagram for mimas::mesa_base:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~mesa_base (void)
 Destructor.
virtual void finish (void)
 Finish output on the image.
virtual void ortho2D (void) const =0
 Switch to two-dimensional drawing mode.
virtual void ortho2D (int x1, int y1, int x2, int y2) const =0
 Switch to two-dimensional drawing mode with clipping.
void setColor (const rgba< unsigned char > &color) const
 Set color.
void setGray (unsigned char gray) const
 Set luminance.
void rectangle (int x1, int y1, int x2, int y2) const
 Draw rectangle.
void text (const std::string &s) const
 Write text.

Protected Member Functions

 mesa_base (x11_display *_display, XVisualInfo *_visualInfo) throw (mimasexception)
 Protected constructor.
void glWrap (bool condition, const char *message) throw (mimasexception)
 Wrapper for converting OpenGL error messages to exceptions.

Protected Attributes

x11_displaydisplay
 X11-display.
XVisualInfo * visualInfo
 X11-visual with desired attributes.
bool finishBase
 State of object.

Static Protected Attributes

static bool existInstance
 There must be only one instance of this class.

Detailed Description

Abstract base class for mesa-functionality.

The mesa-functionality mainly consists in offering initialisation of an OpenGL-context for on-screen- or off-screen-rendering.

After initialisation of a deriving non-abstract class, the OpenGL functionality can be either accessed directly using the OpenGL methods bypassing this class or accessed indirectly by using one of the few wrappers for setting the color, for drawing rectangles and for displaying text, being provided by this class.

At any time there must be only one instance of this class to avoid crashes of X11, side-effects or deadlocks.

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:

Do not forget to initialise glut at the beginning of your program:

    glutInit( &argc, argv );
    

References:

Definition at line 58 of file mesa_base.h.


Constructor & Destructor Documentation

virtual mimas::mesa_base::~mesa_base ( void   )  [virtual]

Destructor.

The destructor just calls the method finish() .

See also:
finish

mimas::mesa_base::mesa_base ( x11_display _display,
XVisualInfo *  _visualInfo 
) throw (mimasexception) [protected]

Protected constructor.

The display and visualInfo variables must be destructed by the calling program.

Parameters:
_display X11 display variable.
_visualInfo X11 visual info structure.


Member Function Documentation

virtual void mimas::mesa_base::finish ( void   )  [virtual]

Finish output on the image.

This method allows finalising of the output without having to destruct this object immediately.

Only call after having finished rendering. This object has to be destructed afterwards.

Reimplemented in mimas::mesa_offscreen< T >, and mimas::mesa_onscreen.

virtual void mimas::mesa_base::ortho2D ( void   )  const [pure virtual]

Switch to two-dimensional drawing mode.

The coordinate system has the origin in the "top-left" corner of the image.

Implemented in mimas::mesa_offscreen< T >, and mimas::mesa_onscreen.

virtual void mimas::mesa_base::ortho2D ( int  x1,
int  y1,
int  x2,
int  y2 
) const [pure virtual]

Switch to two-dimensional drawing mode with clipping.

The coordinate system has the origin in the "top-left" corner of the image.

Implemented in mimas::mesa_offscreen< T >, and mimas::mesa_onscreen.

void mimas::mesa_base::setColor ( const rgba< unsigned char > &  color  )  const [inline]

Set color.

Parameters:
color Color-object. The alpha-component is ignored.

Definition at line 82 of file mesa_base.h.

References mimas::rgba< T >::getBlue(), mimas::rgba< T >::getGreen(), and mimas::rgba< T >::getRed().

Here is the call graph for this function:

void mimas::mesa_base::setGray ( unsigned char  gray  )  const [inline]

Set luminance.

Parameters:
gray The gray-value.

Definition at line 86 of file mesa_base.h.

void mimas::mesa_base::rectangle ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Draw rectangle.

Parameters:
x1 x-coordinate of upper-left corner of rectangle.
y1 y-coordinate of upper-left corner of rectangle.
x2 x-coordinate of lower-right corner of rectangle.
y2 y-coordinate of lower-right corner of rectangle.

void mimas::mesa_base::text ( const std::string &  s  )  const

Write text.

void mimas::mesa_base::glWrap ( bool  condition,
const char *  message 
) throw (mimasexception) [protected]

Wrapper for converting OpenGL error messages to exceptions.

The wrapper will generate an exception (using gluErrorString), if the condition is not fullfilled.

Parameters:
condition If the condition is false, an exception is thrown.
message Textual description of context, which is prepended to the error-message.


Member Data Documentation

x11_display* mimas::mesa_base::display [protected]

X11-display.

Definition at line 112 of file mesa_base.h.

XVisualInfo* mimas::mesa_base::visualInfo [protected]

X11-visual with desired attributes.

Definition at line 114 of file mesa_base.h.

bool mimas::mesa_base::finishBase [protected]

State of object.

Definition at line 116 of file mesa_base.h.

bool mimas::mesa_base::existInstance [static, protected]

There must be only one instance of this class.

Definition at line 118 of file mesa_base.h.


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:35 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...