TAPs 0.7.7.3
TAPsGLEXTFrameBufferObject.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsGLEXTFrameBufferObject.hpp
00003 ******************************************************************************/
00055 /******************************************************************************
00056 SUKITTI PUNAK   (10/27/2006)
00057 UPDATE          (11/03/2006)
00058 ******************************************************************************/
00059 #ifndef TAPs_GL_EXT_FRAME_BUFFER_OBJECT_HPP
00060 #define TAPs_GL_EXT_FRAME_BUFFER_OBJECT_HPP
00061 
00062 #include "TAPsGLSLFns.hpp"
00063 
00064 //-----------------------------------------------------------------------------
00065 BEGIN_NAMESPACE_TAPs__OpenGL
00066 //=============================================================================
00067 //-----------------------------------------------------------------------------
00068 // Useful Macros
00069 /*
00070 #ifdef TAPs_GLSL_WINDOWS
00071 #define MacrosLoadExtension( fnType, fnName ) ( ( fnName = (fnType) wglGetProcAddress( #fnName ) ) == NULL )
00072 #endif
00073 #ifdef TAPs_GLSL_LINUX
00074 #define MacrosLoadExtension( fnType, fnName ) ( ( fnName = (fnType) glXGetProcAddress( #fnName ) ) == NULL )
00075 #endif
00076 bool GFnTestExtension( const char * extName );
00077 */
00078 //=============================================================================
00079 class GLEXTFrameBufferObject
00080 {
00081 public:
00082     //---------------------------------------------------------------
00083     // Buffer Type
00084     static enum BufferType {
00085         FRAME_BUFFER, 
00086         //TEXTURE_BUFFER,
00087         RENDER_BUFFER
00088     };
00089     //---------------------------------------------------------------
00090     GLEXTFrameBufferObject ( BufferType eBufferType, GLuint gluiSize = 1 );
00091     virtual ~GLEXTFrameBufferObject ();
00092     //---------------------------------------------------------------
00093     BufferType  GetBufferType () const  {   return m_eBufferType; }
00094     GLuint  GetSize ()          const   {   return m_gluiSize; }
00095     GLuint  GetID ()            const   {   return m_pgluiID[0]; }
00096     GLuint  GetID ( GLuint i )  const   {   assert( i < GetSize() );    
00097                                             return m_pgluiID[i]; }
00098     //GLuint    GetSavedID ()   const   {   return m_pgluiID_StackValue; }
00099     //---------------------------------------------------------------
00100     // Attach Texture Buffer
00101     inline void AttachTextureBuffer ( 
00102         GLenum  attachment, 
00103         GLenum  textarget, 
00104         GLuint  texture, 
00105         GLint   level   = 0, 
00106         GLint   zoffset = 0 )
00107     { AttachTextureBuffer( 0, attachment, textarget, texture, level, zoffset ); }
00108     //---------------------------------
00109     inline void AttachTextureBuffer ( 
00110         GLuint  i, 
00111         GLenum  attachment, 
00112         GLenum  textarget, 
00113         GLuint  texture, 
00114         GLint   level   = 0, 
00115         GLint   zoffset = 0 );
00116     //---------------------------------------------------------------
00117     // Attach Render Buffer
00118     inline void AttachRenderBuffer ( 
00119         GLenum attachment, 
00120         GLuint renderbufferID )
00121     { AttachRenderBuffer( 0, attachment, renderbufferID ); }
00122     //---------------------------------
00123     inline void AttachRenderBuffer ( 
00124         GLuint i, 
00125         GLenum attachment, 
00126         GLuint renderbufferID );
00127     //---------------------------------------------------------------
00128     // ???
00129     //inline void Unattach ( GLenum attachment );
00130     //---------------------------------------------------------------
00131     // Render Buffer Object
00192     //-------------------------------------------
00196     inline bool IsRenderBuffer ( GLuint i = 0 );
00197     //-------------------------------------------
00201     inline void BindRenderBuffer    ( GLuint i = 0 );
00202     //---------------------------------
00203     static inline void  UnbindAllRenderBuffers ()
00204     { DisableAllRenderBuffers(); }
00205     //-------------------------------------------
00212     inline void DeleteRenderBuffers ();
00213     //-------------------------------------------
00219     inline void GenRenderBuffers ();
00220     //-------------------------------------------
00257     inline void RenderBufferStorage ( // assume GLuint = 0
00258         GLenum internalformat, GLsizei width, GLsizei height )
00259     { RenderBufferStorage( 0, internalformat, width, height ); }
00260     //---------------------------------
00261     inline void RenderBufferStorage ( GLuint i, 
00262         GLenum internalformat, GLsizei width, GLsizei height );
00263     //-------------------------------------------
00313     // ???
00314     inline void GetRenderBufferParameter ();
00315     //---------------------------------------------------------------
00316     // Frame Buffer Object
00317     //-------------------------------------------
00321     inline bool IsFrameBuffer ( GLuint i = 0 );
00322     //-------------------------------------------
00326     inline void BindFrameBuffer ( GLuint i = 0 );
00327     //---------------------------------
00328     static inline void UnbindAllFrameBuffers ()
00329     { DisableAllFrameBuffers(); }
00330     //-------------------------------------------
00336     inline void DeleteFrameBuffers ();
00337     //-------------------------------------------
00343     inline void GenFrameBuffers ();
00344     //---------------------------------------------------------------
00348 #ifndef TAPs_DEBUG_MODE
00349     inline bool CheckFrameBufferStatus ( GLuint i = 0 );
00350 #else
00351     inline bool CheckFrameBufferStatus ( GLuint i = 0 ) { return true; }
00352 #endif
00353 
00361     //---------------------------------------------------------------
00396     inline void FrameBufferTexture1D ( 
00397         GLenum  attachment, 
00398         GLenum  textarget, 
00399         GLuint  texture, 
00400         GLint   level 
00401     );
00402     //-------------------------------------------
00450     inline void FrameBufferTexture2D (
00451         GLenum  attachment, 
00452         GLenum  textarget, 
00453         GLuint  texture, 
00454         GLint   level 
00455     );
00456     //-------------------------------------------
00495     inline void FrameBufferTexture3D (
00496         GLenum  attachment, 
00497         GLenum  textarget, 
00498         GLuint  texture, 
00499         GLint   level, 
00500         GLint   zoffset 
00501     );
00502     //-------------------------------------------
00573     inline void FrameBufferRenderBuffer (
00574         GLenum attachment,
00575         GLuint renderbuffer
00576     );
00577     //-------------------------------------------
00663     inline GLint    GetFrameBufferAttachmentParameter (
00664         GLenum  attachment, 
00665         GLenum  pname )
00666     { return GetFrameBufferAttachmentParameter( 0, attachment, pname ); }
00667     //---------------------------------
00668     inline GLint    GetFrameBufferAttachmentParameter (
00669         GLuint  i, 
00670         GLenum  attachment, 
00671         GLenum  pname );
00672     //-------------------------------------------
00727     inline GLint    GetRenderbufferParameter (
00728         GLenum  attachment, 
00729         GLenum  pname )
00730     { return GetRenderbufferParameter( 0, attachment, pname ); }
00731     //---------------------------------
00732     inline GLint    GetRenderbufferParameter (
00733         GLuint  i, 
00734         GLenum  attachment, 
00735         GLenum  pname );
00736     //-------------------------------------------
00740     // ???
00741     inline void GenerateMipmap ();
00742     //---------------------------------------------------------------
00743     static inline GLint InquireMaxColorAttachments ();
00744     static inline GLint InquireMaxRenderBufferSize ();
00745     static inline void  DisableAllRenderBuffers ();
00746     static inline void  DisableAllFrameBuffers ();
00747     //---------------------------------------------------------------
00748 protected:
00749     //---------------------------------------------------------------
00750     // Member Functions
00754     inline void ProtectedBindFrameBuffer ( GLuint i );
00755     //-------------------------------------------
00759     inline void ProtectedUnbindFrameBuffer ( GLuint i );
00760     //---------------------------------------------------------------
00764     inline void ProtectedBindRenderBuffer ( GLuint i );
00765     //-------------------------------------------
00769     inline void ProtectedUnbindRenderBuffer ( GLuint i );
00770     //---------------------------------------------------------------
00771     // Data Members
00772     static unsigned int     g_uiObjCounters;
00773     BufferType  m_eBufferType;
00774     GLuint      m_gluiSize;
00775     GLuint *    m_pgluiID;
00776     GLuint *    m_pgluiID_StackValue;
00777     //---------------------------------------------------------------
00778 };  // End Class TAPsGLEXTFrameBufferObject
00779 //-----------------------------------------------------------------------------
00780 //=============================================================================
00781 END_NAMESPACE_TAPs__OpenGL
00782 //-----------------------------------------------------------------------------
00783 // Include definition if TAPs_USE_EXPORT is not defined
00784 #if !defined( TAPs_USE_EXPORT )
00785     #include "TAPsGLEXTFrameBufferObject.cpp"
00786 #endif
00787 //-----------------------------------------------------------------------------
00788 #endif
00789 //34567890123456789012345678901234567890123456789012345678901234567890123456789
00790 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines