Changeset 7074 for OpenSceneGraph/trunk/src/osgDB/DatabasePager.cpp
- Timestamp:
- 07/06/07 15:08:51 (6 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgDB/DatabasePager.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgDB/DatabasePager.cpp
r7038 r7074 293 293 startThread(); 294 294 } 295 296 295 } 297 296 } … … 595 594 } 596 595 597 if (loadedObjectsNeedToBeCompiled && !_compileGraphicsContexts.empty())598 { 599 for( CompileGraphicsContexts::iterator citr = _compileGraphicsContexts.begin();600 citr != _compileGraphicsContexts.end();601 ++ citr)596 if (loadedObjectsNeedToBeCompiled) 597 { 598 for(ActiveGraphicsContexts::iterator itr = _activeGraphicsContexts.begin(); 599 itr != _activeGraphicsContexts.end(); 600 ++itr) 602 601 { 603 osg::GraphicsContext* gc = citr->get();602 osg::GraphicsContext* gc = osg::GraphicsContext::getCompileContext(*itr); 604 603 if (gc) 605 604 { 606 osg::OperationsThread* gt = gc->getGraphicsThread(); 607 if (gt) gt->add(new DatabasePager::CompileOperation(this)); 605 osg::OperationsThread* gt = gc->getGraphicsThread(); 606 if (gt) 607 { 608 gt->add(new DatabasePager::CompileOperation(this)); 609 } 608 610 else 609 611 { 610 612 gc->makeCurrent(); 611 612 // osg::notify(osg::NOTICE)<<"Database pager thread compiling"<<std::endl;613 613 614 614 compileAllGLObjects(*(gc->getState())); … … 618 618 } 619 619 } 620 620 621 // osg::notify(osg::NOTICE)<<"Done compiling in paging thread"<<std::endl; 621 622 } … … 884 885 } 885 886 886 void DatabasePager::addCompileGraphicsContext(osg::GraphicsContext* gc)887 {888 for(CompileGraphicsContexts::iterator itr = _compileGraphicsContexts.begin();889 itr != _compileGraphicsContexts.end();890 ++itr)891 {892 if (*itr == gc)893 {894 return;895 }896 }897 898 _compileGraphicsContexts.push_back(gc);899 900 setCompileGLObjectsForContextID(gc->getState()->getContextID(),true);901 }902 903 void DatabasePager::removeCompileGraphicsContext(osg::GraphicsContext* gc)904 {905 for(CompileGraphicsContexts::iterator itr = _compileGraphicsContexts.begin();906 itr != _compileGraphicsContexts.end();907 ++itr)908 {909 if (*itr == gc)910 {911 _compileGraphicsContexts.erase(itr);912 return;913 }914 }915 }916 917 887 void DatabasePager::setCompileGLObjectsForContextID(unsigned int contextID, bool on) 918 888 { … … 952 922 { 953 923 if (_activeGraphicsContexts.count(contextID)==0) return false; 954 955 for(CompileGraphicsContexts::const_iterator citr = _compileGraphicsContexts.begin(); 956 citr != _compileGraphicsContexts.end(); 957 ++citr) 958 { 959 const osg::GraphicsContext* gc = citr->get(); 960 if (gc && gc->getState()->getContextID()==contextID) return false; 961 } 962 963 return true; 924 925 return osg::GraphicsContext::getCompileContext(contextID)==0; 964 926 } 965 927
