3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #define GL_GLEXT_PROTOTYPES
16 Shader::Shader(ShaderType t)
26 void Shader::source(sizei count, const char **str, const int *len)
28 glShaderSource(id, count, str, len);
31 void Shader::source(const string &str)
33 source(str.data(), str.size());
36 void Shader::source(const char *str, int len)
38 source(1, &str, &len);
41 bool Shader::compile()
44 compiled=get_param(GL_COMPILE_STATUS);
48 int Shader::get_param(GLenum param) const
51 glGetShaderiv(id, param, &value);
55 string Shader::get_info_log() const
57 sizei len=get_param(GL_INFO_LOG_LENGTH);
59 glGetShaderInfoLog(id, len+1, reinterpret_cast<GLsizei *>(&len), log);
60 return string(log, len);