Show
Ignore:
Timestamp:
10/06/09 15:42:12 (5 years ago)
Author:
robert
Message:

Fixed the TextureObject?'s + GLBufferObject reassignment to a new set.

Disabled the unref after apply for a Texture classes when the texture pool is enabled

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/Texture.cpp

    r10601 r10606  
    9191        if (_set) 
    9292        { 
    93             // remove self from original set 
    94             _set->remove(this); 
    95  
    96             // get the new set for the new profile 
    97             _set = _set->getParent()->getTextureObjectSet(_profile); 
    98  
    99             // register self with new set. 
    100             _set->addToBack(this); 
     93            _set->moveToSet(this, _set->getParent()->getTextureObjectSet(_profile)); 
    10194        } 
    10295    } 
     
    384377    addToBack(to.get()); 
    385378 
    386     // osg::notify(osg::NOTICE)<<"Reusing orhpahned TextureObject, _numOfTextureObjects="<<_numOfTextureObjects<<std::endl; 
     379    osg::notify(osg::NOTICE)<<"Reusing orhpahned TextureObject, _numOfTextureObjects="<<_numOfTextureObjects<<std::endl; 
    387380 
    388381    return to.release(); 
     
    423416        { 
    424417            original_texture->setTextureObject(_contextID,0); 
    425             // osg::notify(osg::NOTICE)<<"TextureObjectSet="<<this<<": Reusing an active TextureObject "<<to.get()<<" _numOfTextureObjects="<<_numOfTextureObjects<<" width="<<_profile._width<<" height="<<_profile._height<<std::endl; 
     418            osg::notify(osg::NOTICE)<<"TextureObjectSet="<<this<<": Reusing an active TextureObject "<<to.get()<<" _numOfTextureObjects="<<_numOfTextureObjects<<" width="<<_profile._width<<" height="<<_profile._height<<std::endl; 
    426419        } 
    427420        else 
    428421        { 
    429             // osg::notify(osg::NOTICE)<<"Reusing a recently orphaned active TextureObject "<<to.get()<<std::endl; 
     422            osg::notify(osg::NOTICE)<<"Reusing a recently orphaned active TextureObject "<<to.get()<<std::endl; 
    430423        } 
    431424 
     
    454447    addToBack(to); 
    455448 
    456     // osg::notify(osg::NOTICE)<<"Created new TextureObject, _numOfTextureObjects "<<_numOfTextureObjects<<std::endl; 
     449    osg::notify(osg::NOTICE)<<"Created new TextureObject, _numOfTextureObjects "<<_numOfTextureObjects<<std::endl; 
    457450 
    458451    return to; 
     
    601594    to->_next = 0; 
    602595    to->_previous = 0; 
     596} 
     597 
     598void Texture::TextureObjectSet::moveToSet(TextureObject* to, TextureObjectSet* set) 
     599{ 
     600    if (set==this) return; 
     601    if (!set) return; 
     602 
     603    // remove 'to' from original set 
     604    --_numOfTextureObjects; 
     605    remove(to); 
     606 
     607    // register 'to' with new set. 
     608    to->_set = set; 
     609    ++set->_numOfTextureObjects; 
     610    set->addToBack(to); 
    603611} 
    604612