X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2Fshader.cpp;h=5a07143f13e21fa8ae28802a6c4a25827451ac4f;hb=c0a5ece0f6bacea1b85157a908d710070fb0affd;hp=85f0184684eb791ba0f24c79a63c661a39378f1f;hpb=307482574d3acac09e38263de521a1826ceec7ce;p=blank.git diff --git a/src/graphics/shader.cpp b/src/graphics/shader.cpp index 85f0184..5a07143 100644 --- a/src/graphics/shader.cpp +++ b/src/graphics/shader.cpp @@ -9,7 +9,7 @@ #include "ArrayTexture.hpp" #include "CubeMap.hpp" #include "Texture.hpp" -#include "../app/init.hpp" +#include "../app/error.hpp" #include #include @@ -20,29 +20,12 @@ #include -namespace { - -void gl_error(std::string msg) { - const GLubyte *errBegin = gluErrorString(glGetError()); - if (errBegin && *errBegin != '\0') { - const GLubyte *errEnd = errBegin; - while (*errEnd != '\0') { - ++errEnd; - } - msg += ": "; - msg.append(errBegin, errEnd); - } - throw std::runtime_error(msg); -} - -} - namespace blank { Shader::Shader(GLenum type) : handle(glCreateShader(type)) { if (handle == 0) { - gl_error("glCreateShader"); + throw GLError("glCreateShader"); } } @@ -95,7 +78,7 @@ void Shader::AttachToProgram(GLuint id) const noexcept { Program::Program() : handle(glCreateProgram()) { if (handle == 0) { - gl_error("glCreateProgram"); + throw GLError("glCreateProgram"); } }