• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KGLLib

program.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008 Rivo Laks <rivolaks@hot.ee>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either 
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public 
00015  * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef KGLLIB_PROGRAM_H
00019 #define KGLLIB_PROGRAM_H
00020 
00021 namespace KGLLib
00022 {
00023     class Shader;
00024 }
00025 class QString;
00026 template<class T> class QList;
00027 template<class K, class V> class QHash;
00028 
00029 #include "kgllib.h"
00030 #include <Eigen/Core>
00031 
00032 namespace KGLLib
00033 {
00034 
00120 class KGLLIB_EXPORT Program
00121 {
00122 public:
00128     Program();
00133     Program(const QList<Shader*>& shaders);
00139     Program(const QString& vertexshaderfile, const QString& fragmentshaderfile);
00143     virtual ~Program();
00144 
00148     void addShader(Shader* shader);
00152     void addShaders(const QList<Shader*>& shaders);
00153 
00160     virtual bool link();
00161 
00170     bool isValid() const  { return mValid; }
00178     char* linkLog() const  { return mLinkLog; }
00179 
00186     virtual void bind() const;
00195     virtual void unbind() const;
00196 
00197     int uniformLocation(const QString& name);
00198     int uniformLocation(const char* name);
00199 
00200     int attributeLocation(const QString& name);
00201     int attributeLocation(const char* name);
00202 
00203     void invalidateLocations();
00204 
00214     bool setUniform(const char* name, float value);
00218     bool setUniform(const char* name, Eigen::Vector2f value);
00222     bool setUniform(const char* name, Eigen::Vector3f value);
00226     bool setUniform(const char* name, Eigen::Vector4f value);
00230     bool setUniform(const char* name, int value);
00231 
00235     GLuint glId() const  { return mGLId; }
00236 
00237 protected:
00238     void init();
00239 
00240 protected:
00241     GLuint mGLId;
00242     bool mValid;
00243     char* mLinkLog;
00244     QHash<QString, int>* mUniformLocations;
00245     QHash<QString, int>* mAttributeLocations;
00246 };
00247 
00248 }
00249 
00250 #endif

KGLLib

Skip menu "KGLLib"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KGLLib
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal