00001 #ifndef MESA_BASE_H 00002 #define MESA_BASE_H 00003 00004 #include "mimasconfig.h" 00005 00006 #ifdef HAVE_OPENGL 00007 00008 #include <GL/gl.h> 00009 #include <X11/Xlib.h> 00010 #include <X11/Xutil.h> 00011 #include "mimasexception.h" 00012 #include "object.h" 00013 #include "rgba.h" 00014 #include "x11_display.h" 00015 00016 namespace mimas { 00017 00058 class mesa_base: public object 00059 { 00060 public: 00064 virtual ~mesa_base(void); 00071 virtual void finish(void); 00075 virtual void ortho2D(void) const = 0; 00079 virtual void ortho2D( int x1, int y1, int x2, int y2 ) const = 0; 00082 void setColor( const rgba< unsigned char > &color ) const 00083 { glColor3ub( color.getRed(), color.getGreen(), color.getBlue() ); } 00086 void setGray( unsigned char gray ) const 00087 { glColor3ub( gray, gray, gray ); } 00093 void rectangle( int x1, int y1, int x2, int y2 ) const; 00095 void text( const std::string &s ) const; 00096 protected: 00102 mesa_base( x11_display *_display, XVisualInfo *_visualInfo ) 00103 throw (mimasexception); 00110 void glWrap( bool condition, const char *message ) throw (mimasexception); 00112 x11_display *display; 00114 XVisualInfo *visualInfo; 00116 bool finishBase; 00118 static bool existInstance; 00119 }; 00120 00121 }; 00122 00123 #endif 00124 00125 #endif 00126