GLSLShader.h

Go to the documentation of this file.
00001 // Copyright (C) 2005 Dave Griffiths
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 
00017 #ifdef GLSL
00018 #include "GL/glew.h"
00019 #endif
00020 #ifndef __APPLE__
00021 #include "GL/gl.h"
00022 #include "GL/glu.h"
00023 #include "GL/glut.h"
00024 #else
00025 #include "OpenGL/gl.h"
00026 #include "OpenGL/glu.h"
00027 #include "GLUT/glut.h"
00028 #endif
00029 #include <string>
00030 #include <vector>
00031 #include "dada.h"
00032 
00033 #ifndef FLUXUS_GLSL_SHADER
00034 #define FLUXUS_GLSL_SHADER
00035 
00036 using namespace std;
00037 
00038 namespace Fluxus
00039 {
00040 
00043 class GLSLShader
00044 {
00045 public:
00047     GLSLShader(const string &vertexfilename, const string &fragmentfilename);
00048     ~GLSLShader();
00049 
00053     static void Init();
00054     void Apply();
00055     static void Unapply();
00057     
00061     void SetInt(const string &name, int s);
00062     void SetFloat(const string &name, float s);
00063     void SetVector(const string &name, dVector s);
00064     void SetColour(const string &name, dColour s);
00066     
00070     void SetFloatArray(const string &name, const vector<float> &s);
00071     void SetVectorArray(const string &name, const vector<dVector> &s);
00072     void SetColourArray(const string &name, const vector<dColour> &s);
00074     
00075 private:
00077     bool Load(const string &vertexfilename, const string &fragmentfilename);
00078 
00079     unsigned int LoadShader(string filename, unsigned int type);
00080     unsigned int m_Program;
00081     static bool m_Enabled;
00082 };
00083 
00084 }
00085 
00086 #endif

Generated on Mon Feb 11 06:54:25 2008 for The Fluxus Renderer (libfluxus) by  doxygen 1.5.1