Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

pbuffer.h

00001 //FILE:     pbuffer.h
00002 //AUTHOR:   Andrew Van Pernis <arakel@vr.clemson.edu>
00003 
00004 #ifndef UBER_PBUFFER_H
00005 #define UBER_PBUFFER_H 1
00006 
00007 #include <string>
00008 #include <GL/glx.h>
00009 #include "texture.h"
00010 
00011 namespace gl {
00012         class pixel_buffer;
00013 }
00014 
00016 
00021 class gl::pixel_buffer {
00022  protected:
00023   unsigned int m_width;    
00024   unsigned int m_height;   
00025   unsigned int m_bpp;      
00026   bool m_initialized;      
00027   bool m_error;            
00028   std::string m_error_msg; 
00029   gl::texture m_texture;   
00030 #ifdef GLX_SGIX_fbconfig
00031 #ifdef GLX_SGIX_pbuffer
00032   Display *m_display;                   
00033   GLXPbuffer m_pixel_buffer;            
00034   GLXContext m_pixel_buffer_context;    
00035   GLXFBConfigSGIX *m_available_configs; 
00036   int m_num_available_configs;          
00037 #endif
00038 #endif  
00039 
00041   inline void clear_error(void){
00042     m_error = false;
00043     m_error_msg = "none";
00044   }
00045 
00047   inline void set_error(const std::string& msg){
00048     m_error = true;
00049     m_error_msg = msg;
00050   }
00051   
00052  public:
00054   pixel_buffer(void): 
00055     m_initialized(false), m_error(false), m_error_msg("none")
00056     {
00057 #ifdef GLX_SGIX_fbconfig
00058       m_available_configs = NULL;
00059       m_num_available_configs = 0;
00060 #endif
00061     }
00062 
00064   virtual ~pixel_buffer(void){
00065 #ifdef GLX_SGIX_fbconfig
00066     if (m_available_configs != NULL)
00067       delete(m_available_configs);
00068 #endif
00069     if (m_initialized)
00070       shutdown();
00071   }
00072 
00074 
00083   virtual bool init(unsigned int w, unsigned int h, unsigned int bpp, GLXContext shared);
00084 
00086 
00098   virtual bool init(unsigned int w, unsigned int h, unsigned int bpp, const int attributes[], GLXContext shared);
00099    
00101   virtual void activate(void);
00102 
00104 
00108   virtual void shutdown(void);
00109 
00111   inline unsigned int get_width(void) const {
00112     return m_width;
00113   }
00114 
00116   inline unsigned int get_height(void) const {
00117     return m_height;
00118   }
00119 
00121   inline bool error(void) const {
00122     return m_error;
00123   }
00124 
00126   inline std::string get_error(void){
00127     std::string msg(m_error_msg);
00128     clear_error();
00129     return msg;
00130   }
00131 
00133   inline gl::texture get_texture(void) const {
00134     return m_texture;
00135   }
00136 
00137 #ifdef GLX_SGIX_fbconfig
00138 
00139   static const int VISUAL_ATTRIBUTES_8BPP[];
00140   
00142   static const int VISUAL_ATTRIBUTES_16BPP[];
00143   
00145   static const int VISUAL_ATTRIBUTES_24BPP[];
00146   
00148   static const int VISUAL_ATTRIBUTES_32BPP[];
00149 
00151   static const int PIXEL_BUFFER_ATTRIBUTES[];
00152 #endif
00153 };
00154 
00155 #endif

Generated on Tue Feb 11 18:49:41 2003 for uber by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002