X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fshader.cpp;h=b620641e5af789bc2c3cc5fe87edcc1799f61249;hb=e9374cde7e471b0150140b37e5bd7cd5a0d720d9;hp=1b3455f1aa91270c810d0494ac80c3e80b7fe051;hpb=6924ea10c4111b11eab51f0e1aa5b4a6438da7d3;p=libs%2Fgl.git diff --git a/source/shader.cpp b/source/shader.cpp index 1b3455f1..b620641e 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(EXT_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