$search
00001 /* Shader 00002 * 00003 * Copyright (C) 2005, Maurizio Monge <maurizio.monge@gmail.com> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef __SHADER_H__ 00021 #define __SHADER_H__ 00022 00023 00024 00025 #include <blort/Tracker/headers.h> 00026 #include <blort/TomGine/tgMathlib.h> 00027 00028 namespace Tracking{ 00029 00033 class Shader{ 00034 private: 00035 GLhandleARB fragment; 00036 GLhandleARB vertex; 00037 GLhandleARB program; 00038 public: 00039 Shader( const char *vertex_file = NULL, 00040 const char *fragment_file = NULL, 00041 const char *header = NULL); 00042 ~Shader(); 00043 00044 void bind(); 00045 void unbind(); 00046 void dumpVars(); 00047 void printInfoLog(GLhandleARB obj, const char *msg, ...); 00048 bool getStatus(); 00049 00050 GLuint getAttribLoc(const char*); 00051 GLint getUniformLoc(const char*); 00052 void setUniform(const char*,int); 00053 void setUniform(const char*,unsigned); 00054 void setUniform(const char*,int,const int*); 00055 void setUniform(const char*,float); 00056 void setUniform(const char*,int,const float*); 00057 void setUniform(const char*,vec2); 00058 void setUniform(const char* var,int n,vec2* f); 00059 void setUniform(const char*,vec3); 00060 void setUniform(const char* var,int n,vec3* f); 00061 void setUniform(const char*,vec4); 00062 void setUniform(const char* var,int n,vec4* f); 00063 void setUniform(const char*,mat3,bool transpose=false); 00064 void setUniform(const char* var,int n,mat3* f,bool transpose); 00065 void setUniform(const char*,mat4,bool transpose=false); 00066 void setUniform(const char* var,int n,mat4* f,bool transpose); 00067 00068 00069 }; 00070 00071 } //namespace Tracking 00072 00073 #endif //__SHADER_H__