00001 /////////////////////////////////////////////////////////////////////////////// 00002 // 10/02/02 Aaron Lefohn Scientific Computing and Imaging Institute 00003 // School of Computing University of Utah 00004 00005 #ifndef SUB_PBUFF_GLIFT_H 00006 #define SUB_PBUFF_GLIFT_H 00007 00008 #include "pbuffGlift.h" 00009 #include <vector> 00010 00011 namespace glift { 00012 00013 // Typedefs 00014 class SubPBuff; 00015 typedef std::vector<SubPBuff> VecSubPbuff; 00016 typedef std::vector<SubPBuff*> VecSubPbuffP; 00017 00018 /////////////////////////////////////////////////////////////////////////////// 00019 /// 00020 /// SubPBuff - A Wrapper class to make sub-buffers within a larger pbuffer 00021 /// - Sets and restores the viewport specified for this subBuffer 00022 /// - Can also specify a surface (GL_FRONT_LEFT, GL_AUXn, etc) 00023 /// 00024 /// PBuffGlift 00025 ///////////////////////////////// 00026 class SubPBuff : public PBuffGlift 00027 { 00028 public: 00029 // Set the origin and dimen for the sub-buffer 00030 SubPBuff( PBuffGlift* pbuff, GLenum surface ); 00031 SubPBuff( PBuffGlift* pbuff, const gutz::vec2i& origin, const gutz::vec2i& dimen, GLenum surface = GL_FRONT_LEFT ); 00032 00033 // Using default copy constructor and assignment operator 00034 virtual ~SubPBuff(); 00035 00036 // Enable/Disable pbuffer as a draw target 00037 // Disable will restore previous state if enable(true) was called. 00038 virtual void enable(bool saveState=false); 00039 00040 // Accessors 00041 gutz::vec2i origin() const { return m_origin; } 00042 gutz::vec2i subDimen() const { return m_dimen; } 00043 GLenum glSurface() const { return m_glSurface; } 00044 GLenum wglSurface() const { return m_wglSurface;} 00045 00046 protected: 00047 virtual void bindDef(); 00048 virtual void releaseDef(); 00049 00050 private: 00051 gutz::vec2i m_origin; 00052 gutz::vec2i m_dimen; 00053 GLenum m_glSurface; // GL surface name 00054 GLenum m_wglSurface;// WGL surface name 00055 00056 SubPBuff(); // Disallow default construction 00057 00058 GLenum getWglSurface( GLenum glSurf ); // Convert GL surface name to WGL surface name 00059 }; 00060 00061 } // End namespace 00062 00063 #endif 00064