X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fshader.cpp;h=0c356f5f460826f7e97877881d15f35ba3db36f0;hp=ac604630904a6c8db9632dff8f8e715976f2d0cf;hb=HEAD;hpb=1431f24f29bd6862d547b831c40b2686ff56d1ef diff --git a/source/shader.cpp b/source/shader.cpp deleted file mode 100644 index ac604630..00000000 --- a/source/shader.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#define GL_GLEXT_PROTOTYPES -#include "shader.h" - -using namespace std; - -namespace Msp { -namespace GL { - -Shader::Shader(ShaderType t) -{ - id=glCreateShader(t); -} - -Shader::~Shader() -{ - glDeleteShader(id); -} - -void Shader::source(sizei count, const char **str, const int *len) -{ - glShaderSource(id, count, str, len); -} - -void Shader::source(const string &str) -{ - source(str.data(), str.size()); -} - -void Shader::source(const char *str, int len) -{ - source(1, &str, &len); -} - -bool Shader::compile() -{ - glCompileShader(id); - compiled=get_param(GL_COMPILE_STATUS); - return compiled; -} - -int Shader::get_param(GLenum param) const -{ - int value; - glGetShaderiv(id, param, &value); - return value; -} - -string Shader::get_info_log() const -{ - sizei len=get_param(GL_INFO_LOG_LENGTH); - char log[len+1]; - glGetShaderInfoLog(id, len+1, reinterpret_cast(&len), log); - return string(log, len); -} - -} // namespace GL -} // namespace Msp