]> git.tdb.fi Git - libs/gl.git/blob - source/shader.h
Add shaders
[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/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();
29
30         void source(sizei count, const char **str, const int *len);
31         void source(const std::string &str);
32         void source(const char *str, int len);
33         bool compile();
34         uint get_id() const { return id; }
35         bool get_compiled() const { return compiled; }
36         int get_param(GLenum param) const;
37         std::string get_info_log() const;
38 private:
39         uint id;
40         bool compiled;
41 };
42
43 } // namespace GL
44 } // namespace Msp
45
46 #endif