]> git.tdb.fi Git - libs/gl.git/blobdiff - source/shader.h
Add getters for RenderTarget width and height
[libs/gl.git] / source / shader.h
index 9482c4ad3730b1c68e63494f433e1f604a487aca..bab11a7e9603e8bcc32652427b20ade4e7796267 100644 (file)
@@ -1,10 +1,3 @@
-/* $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_
 
@@ -14,25 +7,25 @@ Distributed under the LGPL
 namespace Msp {
 namespace GL {
 
-enum ShaderType
-{
-       FRAGMENT_SHADER = GL_FRAGMENT_SHADER_ARB,
-       VERTEX_SHADER   = GL_VERTEX_SHADER_ARB
-};
+/**
+A single shader stage.  Shaders must be attached to a Program to be used.
 
+This class can't be instantiated directly.  Use one of the VertexShader and
+FragmentShader classes to create Shaders.
+*/
 class Shader
 {
 private:
        unsigned id;
        bool compiled;
 
-public:
-       Shader(ShaderType t);
-       Shader(ShaderType t, const std::string &);
+protected:
+       Shader(GLenum t);
+       Shader(GLenum t, const std::string &);
 private:
-       void init(ShaderType);
+       void init(GLenum);
 public:
-       ~Shader();
+       virtual ~Shader();
 
        void source(unsigned count, const char **str, const int *len);
        void source(const std::string &str);
@@ -43,6 +36,30 @@ public:
        std::string get_info_log() const;
 };
 
+
+class VertexShader: public Shader
+{
+public:
+       VertexShader();
+       VertexShader(const std::string &);
+};
+
+
+class FragmentShader: public Shader
+{
+public:
+       FragmentShader();
+       FragmentShader(const std::string &);
+};
+
+
+class GeometryShader: public Shader
+{
+public:
+       GeometryShader();
+       GeometryShader(const std::string &);
+};
+
 } // namespace GL
 } // namespace Msp