]> git.tdb.fi Git - libs/gl.git/blob - source/shader.h
Use RAII checks for extensions and versions
[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 #include "types.h"
14
15 namespace Msp {
16 namespace GL {
17
18 enum ShaderType
19 {
20         FRAGMENT_SHADER = GL_FRAGMENT_SHADER,
21         VERTEX_SHADER   = GL_VERTEX_SHADER
22 };
23
24 class Shader
25 {
26 public:
27         Shader(ShaderType t);
28         Shader(ShaderType t, const std::string &);
29 private:
30         void init(ShaderType);
31 public:
32         ~Shader();
33
34         void source(sizei count, const char **str, const int *len);
35         void source(const std::string &str);
36         void source(const char *str, int len);
37         void compile();
38         uint get_id() const { return id; }
39         bool get_compiled() const { return compiled; }
40         int get_param(GLenum param) const;
41         std::string get_info_log() const;
42 private:
43         uint id;
44         bool compiled;
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif