00001 #ifndef MESA_OFFSCREEN_H 00002 #define MESA_OFFSCREEN_H 00003 00004 #include "mimasconfig.h" 00005 00006 #ifdef HAVE_OPENGL 00007 00008 #include <boost/shared_ptr.hpp> 00009 #include "image.h" 00010 #include "mesa_base.h" 00011 #include "rgba.h" 00012 00013 #ifndef HAVE_OSMESA 00014 #define GLX_GLXEXT_PROTOTYPES 00015 #include <GL/glx.h> 00016 #else 00017 #include <GL/gl.h> 00018 #ifndef GLAPIENTRY 00019 #define GLAPIENTRY 00020 #endif 00021 #include <GL/osmesa.h> 00022 #endif 00023 00024 namespace mimas { 00025 00057 template< typename T > 00058 class mesa_offscreen: public mesa_base 00059 { 00060 public: 00065 mesa_offscreen( x11_display *_display, image< T > &image, 00066 bool depthBuffer = false ); 00070 virtual ~mesa_offscreen(void); 00078 virtual void finish(void); 00081 virtual void ortho2D( int x1, int y1, int x2, int y2 ) const; 00084 virtual void ortho2D(void) const; 00085 protected: 00087 GLenum getFormat(void) const throw (mimasexception); 00089 void setupColorScale(void) const; 00090 #ifndef HAVE_OSMESA 00092 Pixmap pixmap; 00094 GLXPixmap glxPixmap; 00096 GLXContext context; 00098 void *data; 00099 #else 00101 OSMesaContext context; 00102 #endif 00104 int width; 00106 int height; 00108 bool finishOffscreen; 00109 }; 00110 00111 }; 00112 00113 #include "mesa_offscreen.tcc" 00114 00115 #endif 00116 00117 #endif 00118