00001 #include <simgear/scene/material/GLPredicate.hxx> 00002 00003 #include <algorithm> 00004 #include <boost/bind.hpp> 00005 00006 #include <osg/GLExtensions> 00007 #include <osg/Math> 00008 00009 namespace simgear 00010 { 00011 using namespace std; 00012 using namespace osg; 00013 using namespace boost; 00014 00015 bool GLPredicate::operator ()(unsigned int contextID) 00016 { 00017 float versionNumber = getGLVersionNumber() * 10.0f; 00018 float required = (static_cast<float>(majorVersion) * 10.0f 00019 + static_cast<float>(minorVersion)); 00020 if (versionNumber < required 00021 && !osg::equivalent(versionNumber, required)) 00022 return false; 00023 return (find_if(extensions.begin(), extensions.end(), 00024 !bind(isGLExtensionSupported, contextID, 00025 bind(&string::c_str, _1))) 00026 == extensions.end()); 00027 } 00028 }