]> git.tdb.fi Git - libs/gl.git/blob - source/shader.h
9482c4ad3730b1c68e63494f433e1f604a487aca
[libs/gl.git] / source / shader.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_SHADER_H_
9 #define MSP_GL_SHADER_H_
10
11 #include <string>
12 #include "gl.h"
13
14 namespace Msp {
15 namespace GL {
16
17 enum ShaderType
18 {
19         FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB,
20         VERTEX_SHADER   = GL_VERTEX_SHADER_ARB
21 };
22
23 class Shader
24 {
25 private:
26         unsigned id;
27         bool compiled;
28
29 public:
30         Shader(ShaderType t);
31         Shader(ShaderType t, const std::string &);
32 private:
33         void init(ShaderType);
34 public:
35         ~Shader();
36
37         void source(unsigned count, const char **str, const int *len);
38         void source(const std::string &str);
39         void source(const char *str, int len);
40         void compile();
41         unsigned get_id() const { return id; }
42         bool is_compiled() const { return compiled; }
43         std::string get_info_log() const;
44 };
45
46 } // namespace GL
47 } // namespace Msp
48
49 #endif