]> git.tdb.fi Git - libs/gl.git/blobdiff - source/shader.h
Add shaders
[libs/gl.git] / source / shader.h
diff --git a/source/shader.h b/source/shader.h
new file mode 100644 (file)
index 0000000..4e02b08
--- /dev/null
@@ -0,0 +1,46 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_SHADER_H_
+#define MSP_GL_SHADER_H_
+
+#include <string>
+#include <GL/gl.h>
+#include "types.h"
+
+namespace Msp {
+namespace GL {
+
+enum ShaderType
+{
+       FRAGMENT_SHADER = GL_FRAGMENT_SHADER,
+       VERTEX_SHADER   = GL_VERTEX_SHADER
+};
+
+class Shader
+{
+public:
+       Shader(ShaderType t);
+       ~Shader();
+
+       void source(sizei count, const char **str, const int *len);
+       void source(const std::string &str);
+       void source(const char *str, int len);
+       bool compile();
+       uint get_id() const { return id; }
+       bool get_compiled() const { return compiled; }
+       int get_param(GLenum param) const;
+       std::string get_info_log() const;
+private:
+       uint id;
+       bool compiled;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif