00001 #ifndef PROGRAM_H 00002 #define PROGRAM_H 00003 00005 #ifndef RT_GLES1 00006 00007 #include "Types.h" 00008 #include "Util.h" 00009 #include "RelationalNode.h" 00010 00011 #include <map> 00012 00013 using namespace std; 00014 00015 namespace RenderTools { 00016 00017 class Program : public AbstractPropertyContainer { 00018 public: 00019 00020 Program( void ); 00021 virtual ~Program( void ); 00022 00023 static PropertyPtr create( const XMLNodePtr & xml = XMLNodePtr() ); 00024 virtual void createProperties( void ); 00025 virtual const string getTypeName( bool ofComponent = false ) const; 00026 virtual void onInitialize( void ); 00027 GLuint getProgramID( void ) const; 00028 GLuint getVertexID( void ) const; 00029 GLuint getFragmentID( void ) const; 00030 const PropertyContainerPtr getUniforms( void ) const; 00031 const PropertyPtr findUniform( const string name ) const; 00032 bool bind( const string uniform, const string value ); 00033 bool bind( const PropertyPtr uniform ); 00034 unsigned int bind( void ); 00035 ProgramPtr getSharedPtrProgram( void ); 00036 const ProgramPtr getSharedPtrProgram( void ) const; 00037 static void unbind( void ); 00038 static const ProgramPtr getCurrent( void ){ return( s_current ); } 00039 00040 private: 00041 string readCode( const string filename ); 00042 void extractUniforms( const string shader ); 00043 void printShaderInfo( GLuint shader ); 00044 void printProgramInfo( GLuint program ); 00045 void printInfoLog( ); 00046 00047 PropertyContainerPtr m_uniforms; 00048 string m_vertexShader; 00049 string m_fragmentShader; 00050 GLuint m_programID; 00051 GLuint m_vertexID; 00052 GLuint m_fragmentID; 00053 GLuint m_unit; 00054 static ProgramPtr s_current; 00055 }; 00056 00057 00058 }; // namespace RenderTools 00059 00060 #endif // RT_OPENGL_10 00061 00062 #endif
1.5.8