|
|
@@ -61,9 +61,6 @@ namespace {
|
|
|
errorLineNumber =
|
|
|
errorLog.substr(openParen + 1, closeParen - openParen - 1);
|
|
|
|
|
|
- errorString << fileName << " , "
|
|
|
- << "line " << errorLineNumber << ":\n";
|
|
|
-
|
|
|
std::string errorStart = errorLog.find("error") != std::string::npos
|
|
|
? errorLog.substr(errorLog.find("error"))
|
|
|
: errorLog;
|
|
|
@@ -90,18 +87,17 @@ namespace {
|
|
|
MessageBoxA(nullptr, errorString.str().c_str(), eWindowTitle.c_str(),
|
|
|
MB_OK);
|
|
|
#else
|
|
|
- std::cerr << consoleOutput.str() << std::endl;
|
|
|
std::cerr << errorString.str() << std::endl;
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
void error_formatter::shader_error(GLuint id, std::string const & path) {
|
|
|
- std::string fileName = path.substr(path.find_last_of("/"));
|
|
|
+ std::string fileName = path.substr(path.find_last_of("/") + 1);
|
|
|
error_formatter{id,
|
|
|
fileName,
|
|
|
path,
|
|
|
"GLSL shader compile error!",
|
|
|
- "File location" + path,
|
|
|
+ "File location: " + path,
|
|
|
"GLSL Compile Error in " + fileName,
|
|
|
glGetShaderiv,
|
|
|
glGetShaderInfoLog}();
|
|
|
@@ -110,7 +106,7 @@ namespace {
|
|
|
void error_formatter::shader_program_error(GLuint id,
|
|
|
std::string const & frag_path,
|
|
|
std::string const & vert_path) {
|
|
|
- std::string fileName = frag_path.substr(frag_path.find_last_of("/"));
|
|
|
+ std::string fileName = frag_path.substr(frag_path.find_last_of("/") + 1);
|
|
|
error_formatter{id,
|
|
|
fileName,
|
|
|
frag_path,
|
|
|
@@ -227,7 +223,7 @@ namespace graphics { namespace shaders {
|
|
|
|
|
|
// 1. Load the vertex shader code (text file) to a new memory buffer
|
|
|
std::string const abs_path = env::resource_file(path);
|
|
|
- if ((buffer = files::load(abs_path))) {
|
|
|
+ if (!(buffer = files::load(abs_path))) {
|
|
|
throw file_read_error("Could not load shader file " + abs_path);
|
|
|
}
|
|
|
|
|
|
@@ -237,7 +233,7 @@ namespace graphics { namespace shaders {
|
|
|
|
|
|
// 3. Associate the shader code with the new shader ID
|
|
|
char const * buffer_ptr = buffer.get();
|
|
|
- glShaderSource(id, 1, &buffer_ptr, nullptr);
|
|
|
+ glShaderSource(id, 1, &buffer_ptr, NULL);
|
|
|
|
|
|
// 4. Compile the shader (the shader compiler is built in to your graphics
|
|
|
// card driver)
|