00001 #ifndef CGLPROGRAM_H 00002 #define CGLPROGRAM_H 00003 00004 /**************************************************************************\ 00005 * REQUIRED HEADERS * 00006 \**************************************************************************/ 00007 00008 #include "Definitions.h" 00009 #include "Memory/mmgr.h" 00010 #include "Memory/IManagedObject.h" 00011 00012 /**************************************************************************\ 00013 * DEFINITIONS * 00014 \**************************************************************************/ 00015 00016 class CGLSurface; 00017 00018 /**************************************************************************\ 00019 * CLASS * 00020 \**************************************************************************/ 00021 class CGLProgram : public IManagedObject 00022 { 00023 00024 /**************************************************************************\ 00025 * PUBLIC CLASS FUNCTIONS * 00026 \**************************************************************************/ 00027 public: 00028 00029 CGLProgram(void); 00030 virtual ~CGLProgram(void); 00031 00032 void SetRenderer(CGLSurface * const); 00033 00034 unsigned int GetProgramID(){return programID;} 00035 00036 //creates a shaderObject, returns a objectID 00037 unsigned int CreateShader(int shaderType); 00038 //attaches a shader object 00039 void AttachShader(unsigned int sObjectID); 00040 //returns NULL or a pointer to the CompileIfoLog 00041 char * Compile(unsigned int sObjectID,const char **source,int nmbOfLines); 00042 //detaches a shader 00043 void Detach(unsigned int sObjectID); 00044 //retrns NULL or a pointer to the linkMessage 00045 char * Link(); 00046 00047 bool LinkSuccess(); 00048 bool InUse(); 00049 void Use(bool tf); 00050 00051 /**************************************************************************\ 00052 * PRIVATE CLASS FUNCTIONS * 00053 \**************************************************************************/ 00054 private: 00055 00056 void Reset(); 00057 00058 /**************************************************************************\ 00059 * PRIVATE CLASS MEMBERS * 00060 \**************************************************************************/ 00061 private: 00062 00063 unsigned int programID; 00064 CGLSurface * pCurrentRenderer; 00065 00066 std::vector<char*> compileMessages; 00067 std::vector<char*> linkMessages; 00068 bool linkSuccess; 00069 }; 00070 00071 #endif // CGLPROGRAM_H