X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fshader.cpp;h=0c356f5f460826f7e97877881d15f35ba3db36f0;hp=1b3455f1aa91270c810d0494ac80c3e80b7fe051;hb=0cacf19c2e6aaa182ae0fcc7dfaae345aedd0e74;hpb=6924ea10c4111b11eab51f0e1aa5b4a6438da7d3 diff --git a/source/shader.cpp b/source/shader.cpp index 1b3455f1..0c356f5f 100644 --- a/source/shader.cpp +++ b/source/shader.cpp @@ -1,6 +1,8 @@ #include +#include #include #include +#include #include "error.h" #include "misc.h" #include "shader.h" @@ -31,6 +33,8 @@ void Shader::init(GLenum t) static Require _req(ARB_fragment_shader); else if(t==GL_VERTEX_SHADER) static Require _req(ARB_vertex_shader); + else if(t==GL_GEOMETRY_SHADER) + static Require _req(ARB_geometry_shader4); id = glCreateShader(t); } @@ -61,6 +65,12 @@ void Shader::compile() compiled = get_shader_i(id, GL_COMPILE_STATUS); if(!compiled) throw compile_error(get_info_log()); + +#ifdef DEBUG + string info_log = get_info_log(); + if(!info_log.empty()) + IO::print("Shader compile info log:\n%s", info_log); +#endif } string Shader::get_info_log() const @@ -91,5 +101,14 @@ FragmentShader::FragmentShader(const string &src): Shader(GL_FRAGMENT_SHADER, src) { } + +GeometryShader::GeometryShader(): + Shader(GL_GEOMETRY_SHADER) +{ } + +GeometryShader::GeometryShader(const string &src): + Shader(GL_GEOMETRY_SHADER, src) +{ } + } // namespace GL } // namespace Msp