00001
00002
00003 #ifndef __FRAME_BUFFER_GLX_H
00004 #define __FRAME_BUFFER_GLX_H
00005
00006 #include <gra/framebuffer/FrameBuffer.h>
00007 #include <GL/glx.h>
00008 #include <GL/gl.h>
00009 #include <unistd.h>
00010
00011 using namespace esg;
00012
00013 namespace gra {
00014
00015 class GRA_EXPORT FrameBufferGLX : public FrameBuffer {
00016 protected:
00017 Display * _pDisplay;
00018 XVisualInfo * _pVisualInfo;
00019 Colormap _colormap;
00020 Window _win;
00021 GLXContext _context;
00022 XEvent _event;
00023 XSetWindowAttributes _winAttr;
00024 XImage * _pImage;
00025 XGCValues _gcValues;
00026 GC _gc;
00027
00028 unsigned long _shiftRed;
00029 unsigned long _shiftGreen;
00030 unsigned long _shiftBlue;
00031 bool _byteRev;
00032
00033 protected:
00034 void _init(const char *);
00035 void _destroy();
00036
00037 public:
00044 FrameBufferGLX(unsigned mode, const char * name = NULL)
00045 : FrameBuffer(mode) { _init(name); }
00046 FrameBufferGLX(unsigned width, unsigned height, unsigned mode, const char * name = NULL)
00047 : FrameBuffer(width, height, mode) { _init(name); }
00048
00052 virtual ~FrameBufferGLX() { _destroy(); }
00053
00057 virtual void setWidth (unsigned);
00058 virtual void setHeight(unsigned);
00059
00064 virtual void showContent();
00065
00078 virtual void setColor(const Camera& ,
00079 unsigned ,
00080 unsigned ,
00081 float ,
00082 const Color3f& );
00083
00084 virtual void setColor(const Camera& ,
00085 unsigned ,
00086 unsigned ,
00087 const Color3f& );
00088
00102 virtual void setColors(const Camera& ,
00103 unsigned ,
00104 unsigned ,
00105 float ,
00106 const Color3f [] ,
00107 unsigned );
00108
00109 virtual void setColors(const Camera& ,
00110 unsigned ,
00111 unsigned ,
00112 const Color3f [] ,
00113 unsigned );
00114
00125 virtual Color3f getColor(unsigned ,
00126 unsigned ) const;
00127
00133 virtual void clearColor(const Color3f& );
00134
00135 };
00136
00137 }
00138
00139 #endif // __FRAME_BUFFER_GLX_H