GlslSet.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2006 Serious Hack Inc.
00004 // 
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library 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 GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
00018 // MA  02110-1301, USA
00020 #ifndef GLSLSET_HPP
00021 #define GLSLSET_HPP
00022 
00023 #include "ShBackend.hpp"
00024 
00025 namespace shgl {
00026 
00027 class GlslCode;
00028 
00029 class GlslSet : public SH::ShBackendSet {
00030 public:
00031   GlslSet();
00032   GlslSet(const SH::ShPointer<GlslCode>& code);
00033   GlslSet(const SH::ShProgramSet& s);
00034   GlslSet(const GlslSet& s);
00035   ~GlslSet();
00036 
00037   GlslSet& operator=(const GlslSet& s);
00038   
00039   void link();
00040   void bind();
00041   void unbind();
00042 
00043   bool empty() const;
00044   bool bound() const;
00045   
00046   void attach(const SH::ShPointer<GlslCode>& code);
00047   void detach(const SH::ShPointer<GlslCode>& code);
00048   void replace(const SH::ShPointer<GlslCode>& code);
00049 
00050   // Currently bound set
00051   static GlslSet* current() { return m_current; }
00052   
00053 private:
00054   SH::ShPointer<GlslCode> m_shaders[2];
00055   GLhandleARB m_arb_program;
00056 
00057   bool m_linked;
00058 
00059   static GlslSet* m_current;
00060 };
00061 
00062 typedef SH::ShPointer<GlslSet> GlslSetPtr;
00063 typedef SH::ShPointer<const GlslSet> GlslSetCPtr;
00064 
00065 }
00066 #endif

Generated on Thu Feb 16 14:51:28 2006 for Sh by  doxygen 1.4.6