"L. Spiro Engine"
|
00001 00016 #ifndef __LSG_OPENGLSTANDARDTEXTURE_H__ 00017 #define __LSG_OPENGLSTANDARDTEXTURE_H__ 00018 00019 #include "../LSGGraphicsLib.h" 00020 #include "../Texture/LSGTextureBase.h" 00021 #include "CriticalSection/LSHCriticalSection.h" 00022 #include "Image/LSIImage.h" 00023 #include "Map/LSTLMap.h" 00024 00025 #ifdef LSG_OGL 00026 00027 namespace lsg { 00028 00035 class COpenGlStandardTexture : public CTextureBase { 00036 friend class COpenGlDepthStencilRenderTarget; 00037 public : 00038 // == Various constructors. 00039 LSE_CALLCTOR COpenGlStandardTexture(); 00040 LSE_CALLCTOR ~COpenGlStandardTexture(); 00041 00042 00043 // == Members. 00048 static CCriticalSection m_csCrit; 00049 00050 // == Functions. 00057 virtual LSBOOL LSE_CALL Activate( LSUINT32 _ui32Slot ); 00058 00062 virtual LSVOID LSE_CALL Reset(); 00063 00069 LSBOOL LSE_CALL SetAsRenderTarget() const; 00070 00074 LSVOID LSE_CALL EndAsRenderTarget() const; 00075 00082 static GLint LSE_CALL GetOpenGlInternalFormatStandard( LSI_PIXEL_FORMAT _pfFormat ); 00083 00090 static GLenum LSE_CALL GetOpenGlFormatStandard( LSI_PIXEL_FORMAT _pfFormat ); 00091 00098 static GLenum LSE_CALL GetOpenGlTypeStandard( LSI_PIXEL_FORMAT _pfFormat ); 00099 00107 static LSVOID LSE_CALL InitOpenGlTextureContext( LSUINT32 _ui32ContextId ); 00108 00114 static LSVOID LSE_CALL CloseOpenGlTextureContext( LSUINT32 _ui32ContextId ); 00115 00121 static LSVOID LSE_CALL SetActiveOpenGlTextureContext( LSUINT32 _ui32ContextId ); 00122 00126 static LSVOID LSE_CALL ClearLastSetTex(); 00127 00131 static LSVOID LSE_CALL ClearLastSetTexAndUnbindAll(); 00132 00133 protected : 00134 // == Types. 00138 CImage m_iTexels; 00139 00143 GLuint m_uiTexture; 00144 00148 GLuint m_uiDepthId; 00149 00153 LSBOOL m_bFlip; 00154 00158 static CMap<LSUINT32, GLuint> m_mFbos; 00159 00163 static LSUINT32 m_ui32ActiveContext; 00164 00165 00166 // == Functions. 00172 LSBOOL LSE_CALL CreateApiTexture(); 00173 00177 LSVOID LSE_CALL ResetApi(); 00178 00179 private : 00180 // == Functions. 00189 LSBOOL LSE_CALL GenerateMipMapsApi( const CImage &_iSrcImage, LSUINT32 _ui32Width, LSUINT32 _ui32Height ); 00190 00191 typedef CTextureBase Parent; 00192 }; 00193 00194 00195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00196 // DEFINITIONS 00197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00198 00199 00200 } // namespace lsg 00201 00202 #endif // #ifdef LSG_OGL 00203 00204 #endif // __LSG_OPENGLSTANDARDTEXTURE_H__