osg::DisplaySettings::instance()->setNumMultiSamples(4);
在osg+mfc下成功实现抗锯齿,在程序初始化的时候,即在osg控制类中,我的是OSG_MFC.cpp(头文件中#include <osg/Multisample>)中的 void cOSG::InitCameraConfig(void){}; 函数中加上:
traits->samples=16; osg::Multisample* pms=new osg::Multisample; pms->setSampleCoverage(1,true); mRoot->getOrCreateStateSet()->setAttributeAndModes(pms,osg::StateAttribute::ON);