Added printFileList to Shader, renamed old global function.

This commit is contained in:
hiker 2015-04-24 08:38:04 +10:00
parent 1a96ed6249
commit bbaf061ae9
2 changed files with 24 additions and 4 deletions

View File

@ -220,6 +220,26 @@ private:
setUniformsImpl<N + 1>(arg...);
} // setUniformsImpl
// ------------------------------------------------------------------------
/** End recursion for variadic template. */
template<typename ...Types>
void printFileList()
{
return;
} // printFileList
// ------------------------------------------------------------------------
/** Variadic template to print a list of file names.
* \param shader_type Ignored (used since the variadic calling function
* has this parameter).
* \param filepath Name of the file to print.
*/
template<typename ...Types>
void printFileList(GLint shader_type, const char *filepath, Types ... args)
{
Log::error("shader", filepath);
printFileList(args...);
} // printFileList
public:

View File

@ -49,16 +49,16 @@ void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Type
}
template<typename ...Types>
void printFileList()
void oldPrintFileList()
{
return;
}
template<typename ...Types>
void printFileList(GLint ShaderType, const char *filepath, Types ... args)
void oldPrintFileList(GLint ShaderType, const char *filepath, Types ... args)
{
Log::error("GLWrapp", filepath);
printFileList(args...);
oldPrintFileList(args...);
}
enum AttributeType
@ -84,7 +84,7 @@ GLint LoadProgram(AttributeType Tp, Types ... args)
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
if (Result == GL_FALSE) {
Log::error("GLWrapp", "Error when linking these shaders :");
printFileList(args...);
oldPrintFileList(args...);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
char *ErrorMessage = new char[InfoLogLength];
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);