X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fshader.cpp;h=1b3455f1aa91270c810d0494ac80c3e80b7fe051;hb=a480d4cc323db7cc77388f5af0094dd593dc66e9;hp=a1c576d8b3384c87fe31ff0e677e95224f21e44b;hpb=619aae12e01f25e79626a94c973927e5599e99a5;p=libs%2Fgl.git diff --git a/source/shader.cpp b/source/shader.cpp index a1c576d8..1b3455f1 100644 --- a/source/shader.cpp +++ b/source/shader.cpp @@ -2,6 +2,7 @@ #include #include #include "error.h" +#include "misc.h" #include "shader.h" using namespace std; @@ -57,16 +58,14 @@ void Shader::source(const char *str, int len) void Shader::compile() { glCompileShader(id); - int value = 0; - glGetShaderiv(id, GL_COMPILE_STATUS, &value); - if(!(compiled = value)) + compiled = get_shader_i(id, GL_COMPILE_STATUS); + if(!compiled) throw compile_error(get_info_log()); } string Shader::get_info_log() const { - GLsizei len = 0; - glGetShaderiv(id, GL_INFO_LOG_LENGTH, &len); + GLsizei len = get_shader_i(id, GL_INFO_LOG_LENGTH); char *buf = new char[len+1]; glGetShaderInfoLog(id, len+1, &len, buf); string log(buf, len);