]> git.tdb.fi Git - libs/gl.git/blobdiff - source/program.cpp
Add a function to determine the active GL profile
[libs/gl.git] / source / program.cpp
index 30c73f33631373c7043a66f20509b7cc09369ea6..82308b3405e0c42cc2086925c7633bd6b6a08770 100644 (file)
@@ -8,6 +8,7 @@
 #include <msp/gl/extensions/arb_vertex_shader.h>
 #include <msp/gl/extensions/ext_gpu_shader4.h>
 #include <msp/gl/extensions/nv_non_square_matrices.h>
+#include <msp/io/print.h>
 #include <msp/strings/format.h>
 #include "buffer.h"
 #include "error.h"
@@ -115,6 +116,12 @@ void Program::link()
        if(!linked)
                throw compile_error(get_info_log());
 
+#ifdef DEBUG
+       std::string info_log = get_info_log();
+       if(!info_log.empty())
+               IO::print("Program link info log:\n%s", info_log);
+#endif
+
        unsigned count = get_program_i(id, GL_ACTIVE_UNIFORMS);
        vector<UniformInfo *> uniforms_by_index(count);
        for(unsigned i=0; i<count; ++i)
@@ -319,6 +326,7 @@ Program::Loader::Loader(Program &p):
 {
        add("attribute",       &Loader::attribute);
        add("fragment_shader", &Loader::fragment_shader);
+       add("geometry_shader", &Loader::geometry_shader);
        add("standard",        &Loader::standard);
        add("vertex_shader",   &Loader::vertex_shader);
 }
@@ -338,6 +346,11 @@ void Program::Loader::fragment_shader(const string &src)
        obj.attach_shader_owned(new FragmentShader(src));
 }
 
+void Program::Loader::geometry_shader(const string &src)
+{
+       obj.attach_shader_owned(new GeometryShader(src));
+}
+
 void Program::Loader::standard()
 {
        ProgramBuilder::StandardFeatures feat;