Don't create std::string on glCheckError unless necessary.

This commit is contained in:
Christian Forfang 2012-11-17 20:46:48 +01:00
parent 044eb85872
commit f9b3e513d2
2 changed files with 4 additions and 3 deletions

View File

@ -34,13 +34,14 @@ namespace sf
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void glCheckError(const std::string& file, unsigned int line) void glCheckError(const char* file, unsigned int line)
{ {
// Get the last error // Get the last error
GLenum errorCode = glGetError(); GLenum errorCode = glGetError();
if (errorCode != GL_NO_ERROR) if (errorCode != GL_NO_ERROR)
{ {
std::string fileString(file);
std::string error = "unknown error"; std::string error = "unknown error";
std::string description = "no description"; std::string description = "no description";
@ -99,7 +100,7 @@ void glCheckError(const std::string& file, unsigned int line)
// Log the error // Log the error
err() << "An internal OpenGL call failed in " err() << "An internal OpenGL call failed in "
<< file.substr(file.find_last_of("\\/") + 1) << " (" << line << ") : " << fileString.substr(fileString.find_last_of("\\/") + 1) << " (" << line << ") : "
<< error << ", " << description << error << ", " << description
<< std::endl; << std::endl;
} }

View File

@ -59,7 +59,7 @@ namespace priv
/// \param line Line number of the source file where the call is located /// \param line Line number of the source file where the call is located
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void glCheckError(const std::string& file, unsigned int line); void glCheckError(const char* file, unsigned int line);
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Make sure that GLEW is initialized /// \brief Make sure that GLEW is initialized