GlslSet.hpp

00001 // Sh: A GPU metaprogramming language.
00002 //
00003 // Copyright 2003-2005 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   
00045   void attach(const SH::ShPointer<GlslCode>& code);
00046   void detach(const SH::ShPointer<GlslCode>& code);
00047   void replace(const SH::ShPointer<GlslCode>& code);
00048 
00049   // Currently bound set
00050   static GlslSet* current() { return m_current; }
00051   
00052 private:
00053   SH::ShPointer<GlslCode> m_shaders[2];
00054   GLhandleARB m_arb_program;
00055 
00056   bool m_linked, m_bound;
00057 
00058   static GlslSet* m_current;
00059 };
00060 
00061 typedef SH::ShPointer<GlslSet> GlslSetPtr;
00062 typedef SH::ShPointer<const GlslSet> GlslSetCPtr;
00063 
00064 }
00065 #endif

Generated on Wed Nov 9 15:29:24 2005 for Sh by  doxygen 1.4.5