![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsOpenGLObj.hpp 00003 ******************************************************************************/ 00009 /****************************************************************************** 00010 SUKITTI PUNAK (08/14/2009) 00011 ******************************************************************************/ 00012 #ifndef TAPs_OPENGL_OBJ_HPP 00013 #define TAPs_OPENGL_OBJ_HPP 00014 00015 //#include "../Core/TAPsStdLib.hpp" 00016 #include "TAPsOpenGLMaterial.hpp" 00017 #include "TAPsOpenGLTexture.hpp" 00018 00019 #ifdef TAPs_USE_WXWIDGETS 00020 #include <wx/Image.h> 00021 #endif//TAPs_USE_WXWIDGETS 00022 00023 BEGIN_NAMESPACE_TAPs__OpenGL 00024 //============================================================================= 00025 class OpenGLObj { 00026 //============================================================================= 00027 public: 00028 // Member Functions ------------------------------------------------------- 00030 friend std::ostream & operator<< ( std::ostream &output, OpenGLObj const &obj ) 00031 { 00032 output << obj.StrInfo(); 00033 return output; 00034 } 00035 //------------------------------------------------------------------------- 00037 OpenGLObj (); 00039 OpenGLObj ( OpenGLObj const &orig ); 00041 ~OpenGLObj (); 00042 //------------------------------------------------------------------------- 00044 virtual std::string StrInfo () const; 00045 //------------------------------------------------------------------------- 00047 inline OpenGLObj & operator= ( OpenGLObj const &orig ); 00048 //------------------------------------------------------------------------- 00049 00050 //#define TAPs_USE_GLSL 00051 //#define TAPs_USE_WXWIDGETS 00052 00053 #ifdef TAPs_USE_GLSL 00054 00055 bool InitShaders ( 00056 std::string const & shaderFileName, 00057 bool useVertexShader, 00058 bool useGeometryShader, 00059 bool useFragmentShader 00060 ); 00062 void ClearShaders (); 00063 00064 OpenGL::GLSLShaderManager glslManager; 00065 OpenGL::GLSLProgramObject * glslProgObj; 00066 #endif//TAPs_USE_GLSL 00067 00068 #ifdef TAPs_USE_WXWIDGETS 00069 00070 //bool InitTexture1D ( std::string & imageFile ); 00072 bool InitTexture2D ( std::string & imageFile ); 00074 //bool InitTexture3D ( std::string & imageFile, int depth ); 00076 void ClearTextures (); 00077 #endif//TAPs_USE_WXWIDGETS 00078 00079 //------------------------------------------------------------------------- 00081 int GetVersionMajorNumber () const { return m_GL_Version[0]; } 00083 int GetVersionMinorNumber () const { return m_GL_Version[1]; } 00085 int GetVersionMinorMinorNumber () const { return m_GL_Version[2]; } 00087 const std::string GetTAPsResourcePath () { return m_GL_TAPsResourcePath; } 00089 virtual void Draw () const; 00090 // Data Members ----------------------------------------------------------- 00091 OpenGL::Material Material; 00092 OpenGL::Texture Texture; 00093 //============================================================================= 00094 protected: 00095 // Member Functions ------------------------------------------------------- 00097 static bool InitOnce (); 00099 static void SetTAPsResourcePath (); 00100 // Data Members ----------------------------------------------------------- 00101 static char m_GL_Version[3]; 00102 static std::string m_GL_TAPsResourcePath; 00103 //============================================================================= 00104 private: 00105 // Member Functions ------------------------------------------------------- 00106 // Data Members ----------------------------------------------------------- 00107 //============================================================================= 00108 }; // END CLASS OpenGLObj 00109 //============================================================================= 00110 END_NAMESPACE_TAPs__OpenGL 00111 //----------------------------------------------------------------------------- 00112 // Include definition if TAPs_USE_EXPORT is not defined 00113 #if !defined( TAPs_USE_EXPORT ) 00114 #include "TAPsOpenGLObj.cpp" 00115 #endif 00116 //----------------------------------------------------------------------------- 00117 #endif 00118 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00119 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----