// Copyright (C) 2005 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. #include #include #include #include #include #include "StateAttribute.hpp" #include "held_ptr.hpp" using namespace boost::python; namespace { DEFINE_STATEATTRIBUTE_CAST(FragmentProgram) } namespace PyOSG { void init_FragmentProgram() { REGISTER_STATEATTRIBUTE_CAST(FragmentProgram); class_, bases > fragment("FragmentProgram", "Encapsulates the OpenGL ARB fragment program state.\n", no_init); scope fragment_scope(fragment); fragment.def(init<>()) .def("getFragmentProgramID", &osg::FragmentProgram::getFragmentProgramID, return_value_policy()) .def("setFragmentProgram", (void (osg::FragmentProgram::*)(const char*)) &osg::FragmentProgram::setFragmentProgram) /** Get the fragment program.*/ .def("getFragmentProgram", (const std::string& (osg::FragmentProgram::*)()) &osg::FragmentProgram::getFragmentProgram, return_value_policy()) /** Set Program Parameters */ .def("setProgramLocalParameter", &osg::FragmentProgram::setProgramLocalParameter) // inline void setProgramLocalParameter(const GLuint index, const Vec4& p) // TODO // typedef std::map LocalParamList; /** Get list of Program Parameters */ // inline LocalParamList& getLocalParamList() { return _programLocalParameters; } // TODO /** Get const list of Program Parameters */ // inline const LocalParamList& getLocalParamList() const { return _programLocalParameters; } /** Matrix */ .def("setMatrix", &osg::FragmentProgram::setMatrix) /** Force a recompile on next apply() of associated OpenGL vertex program objects.*/ .def("dirtyFragmentProgramObject", &osg::FragmentProgram::dirtyFragmentProgramObject) /** use deleteFragmentProgramObject instead of glDeletePrograms to allow * OpenGL Fragment Program objects to be cached until they can be deleted * by the OpenGL context in which they were created, specified * by contextID.*/ .def("deleteFragmentProgramObject", &osg::FragmentProgram::deleteFragmentProgramObject) // static void deleteFragmentProgramObject(unsigned int contextID,GLuint handle); /** flush all the cached fragment programs which need to be deleted * in the OpenGL context related to contextID.*/ .def("flushDeletedFragmentProgramObjects", &osg::FragmentProgram::flushDeletedFragmentProgramObjects) .staticmethod("deleteFragmentProgramObject") .staticmethod("flushDeletedFragmentProgramObjects") ; } }