Glsl.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 GLSL_HPP
00021 #define GLSL_HPP
00022 
00023 #include <string>
00024 #include "GlBackend.hpp"
00025 #include "ShBackend.hpp"
00026 #include "ShProgram.hpp"
00027 #include "ShException.hpp"
00028 
00029 namespace shgl {
00030 
00031 class GlslCodeStrategy : public CodeStrategy {
00032 public:
00033   GlslCodeStrategy(void);
00034   
00035   SH::ShBackendCodePtr generate(const std::string& target,
00036                                 const SH::ShProgramNodeCPtr& shader,
00037                                 TextureStrategy* textures);
00038   SH::ShBackendSetPtr generate_set(const SH::ShProgramSet& s);
00039   bool use_default_set() const;
00040 
00041   void unbind_all_programs();
00042   bool use_default_unbind_all() const;
00043   
00044   GlslCodeStrategy* create(void);
00045 };
00046 
00047 unsigned int glslTarget(const std::string& unit);
00048 
00049 class GlslException : public SH::ShBackendException {
00050 public:
00051   GlslException(const std::string& message);
00052 };
00053 
00054 enum GlslProgramType { SH_GLSL_FP, SH_GLSL_VP }; 
00055 
00056 void print_infolog(GLhandleARB obj, std::ostream& out = std::cerr);
00057 void print_shader_source(GLhandleARB shader, std::ostream& out = std::cerr);
00058 std::string glsl_typename(SH::ShValueType type, int size);
00059 }
00060 
00061 #endif

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