X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fprogram.cpp;h=8bec2f6f488295474804d641516b825de8ef309a;hp=9ed1e634ff4e6c0f214d3dd9aaeebec941d8cb23;hb=b877c737bc5f759e6da25f886ad965e4a274cf2a;hpb=81051dd218aa70cf434358de9a993d5358a8a5e1 diff --git a/source/core/program.cpp b/source/core/program.cpp index 9ed1e634..8bec2f6f 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -19,7 +19,6 @@ #include #include "buffer.h" #include "error.h" -#include "misc.h" #include "program.h" #include "resources.h" #include "glsl/compiler.h" @@ -162,16 +161,18 @@ void Program::add_glsl_stages(const GlslModule &mod, const map &spe void Program::compile_glsl_stage(unsigned stage_id) { glCompileShader(stage_id); - bool compiled = get_shader_i(stage_id, GL_COMPILE_STATUS); + int status = 0; + glGetShaderiv(stage_id, GL_COMPILE_STATUS, &status); - GLsizei info_log_len = get_shader_i(stage_id, GL_INFO_LOG_LENGTH); + int info_log_len = 0; + glGetShaderiv(stage_id, GL_INFO_LOG_LENGTH, &info_log_len); string info_log(info_log_len+1, 0); glGetShaderInfoLog(stage_id, info_log_len+1, &info_log_len, &info_log[0]); info_log.erase(info_log_len); if(module && module->get_format()==Module::GLSL) info_log = static_cast(module)->get_source_map().translate_errors(info_log); - if(!compiled) + if(!status) throw compile_error(info_log); #ifdef DEBUG if(!info_log.empty()) @@ -240,9 +241,12 @@ void Program::link() attributes.clear(); glLinkProgram(id); - linked = get_program_i(id, GL_LINK_STATUS); + int status = 0; + glGetProgramiv(id, GL_LINK_STATUS, &status); + linked = status; - GLsizei info_log_len = get_program_i(id, GL_INFO_LOG_LENGTH); + int info_log_len = 0; + glGetProgramiv(id, GL_INFO_LOG_LENGTH, &info_log_len); string info_log(info_log_len+1, 0); glGetProgramInfoLog(id, info_log_len+1, &info_log_len, &info_log[0]); info_log.erase(info_log_len); @@ -304,7 +308,8 @@ void Program::link() void Program::query_uniforms() { - unsigned count = get_program_i(id, GL_ACTIVE_UNIFORMS); + unsigned count = 0; + glGetProgramiv(id, GL_ACTIVE_UNIFORMS, reinterpret_cast(&count)); uniforms.reserve(count); vector uniform_names(count); for(unsigned i=0; i &uniforms_by_index) { - unsigned count = get_program_i(id, GL_ACTIVE_UNIFORM_BLOCKS); + unsigned count = 0; + glGetProgramiv(id, GL_ACTIVE_UNIFORM_BLOCKS, reinterpret_cast(&count)); // Reserve an extra index for the default block uniform_blocks.reserve(count+1); for(unsigned i=0; i &uniforms_by_inde void Program::query_attributes() { - unsigned count = get_program_i(id, GL_ACTIVE_ATTRIBUTES); + unsigned count = 0; + glGetProgramiv(id, GL_ACTIVE_ATTRIBUTES, reinterpret_cast(&count)); attributes.reserve(count); for(unsigned i=0; i