Hi Robert, I sent you the sample code to reproduce the issues with the texture pool. First, this code is really experimental. The goal is to apply a generated texture on TerrainTile. So it uses a lot of stuff : osgDB::ReadFileCallback to intercept terrain tile loading and a pool of camera with a shared FBO to generate the texture. So not a very basic OSG usage :)
To test the app, you need to pass a VPB database as argument, generated with --terrain. By pressing 'i', you can display the texture pool statistics in the console. To view the problem, you need to navigate on the earth, in order to have a lot of tiles created and destroyed. With the correction on texture pool size, I have a better understanding of what happens. Without the fix on copyTexImage2D (so using moveToSet) : the texture pool size grows when navigating on the earth, texture object are never deleted... With the fix, the texture pool size is kept under a certain limit, everything is working fine. I don't understand why the texture object are not deleted, when they are moved to another set. At first sight, the code looks correct... Cheers, Fabien -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Robert Osfield Sent: jeudi 4 novembre 2010 18:55 To: OpenSceneGraph Submissions Subject: Re: [osg-submissions] Reusing TextureObject in copyTexImage2D Hi Fabian, I have now checked in the changes to include/osg/Texture src/osg/Texture.cpp to correct the setAllocated(..)'s handling of the texture pool size. Cheers, Robert. On Thu, Nov 4, 2010 at 5:41 PM, Robert Osfield <[email protected]> wrote: > HI Fabian, > > <[email protected]> wrote: >> While you are on the subject, I send you a possible fix for the >> texture pool size problem. It compiles but I didn't validate it really works. >> You have a better understanding of the texture pool management, so >> maybe you can decide if the fix is correct. > > The fix looks good, but the addition of the computeSize() made me > curious why it was needed, so I had a look a TextureProfile::set(..) > method, this didn't call computeSize() as it should have, which is why > you had to call computeSize() explicitly. I've now added the call to > computeSize() into the set method so now it should be possible to > simply do: > > // keep previous size > unsigned int previousSize = _profile._size; > > > _profile.set(numMipmapLevels,internalFormat,width,height,depth,border) > ; > > if (_set) > { > _set->moveToSet(this, > _set->getParent()->getTextureObjectSet(_profile)); > > // Update texture pool size > _set->getParent()->getCurrTexturePoolSize() -= > previousSize; > _set->getParent()->getCurrTexturePoolSize() += > _profile._size; > } > > I'm currently awaiting on a clean build before I check this fix in. > > Cheers, > Robert. > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
TexturePoolProblem.cpp
Description: TexturePoolProblem.cpp
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
