X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fshader.cpp;h=d1938ba702fd0c629133e7e588ffebc816fa6d92;hb=66181b3f47322ffc9b8aebf04a8c222abe1a75a2;hp=1b3455f1aa91270c810d0494ac80c3e80b7fe051;hpb=6924ea10c4111b11eab51f0e1aa5b4a6438da7d3;p=libs%2Fgl.git diff --git a/source/shader.cpp b/source/shader.cpp index 1b3455f1..d1938ba7 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" @@ -25,12 +27,15 @@ Shader::Shader(GLenum t, const string &src) void Shader::init(GLenum t) { + static Require _req_base(ARB_shader_objects); compiled = false; if(t==GL_FRAGMENT_SHADER) 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 +66,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 +102,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