[osg-users] Preload textures in graphics card

Robert Osfield robert.osfield at gmail.com
Thu Nov 12 03:34:38 PST 2009

Hi Joseba,

The OSG already pre compiles textures when the graphics context is
realized as long as you've assigned the scene graph prior to realizing
the windows.  If you load and assign the scene graph afterwards then
you'll need to do a precompile step then, but if you already using the
PagedLOD and the DatabasePager it'll already be doing this pre-compile
step for you.   My guess is that this precompile is already done so
redoing won't make any difference.

Now, there is more to keeping textures resident than just compiling
them, and there more to avoiding frame drops that compiling textures,
so... there is a lot left to look into to fix the frame drops.   I
know practically nothing about how you've composed your scene graph or
your hardware so I can't add very much about what to look into next.


On Thu, Nov 12, 2009 at 10:07 AM, Joseba Rodriguez
<jrodriguez at landersimulation.com> wrote:
> Hi,
> I have some big scenes (just one ive file each one). After the viewer is initialized i load one of these scenes (imagine a long road with curves) and i make the camera go along a path.
> The problem is that i notice some frame drops (peaks, mainly in curves, when new geometry comes in view). When i make a second pass, this frame drops disappear. I also used a small app for testing graphics memory and i saw that in these peaks, graphics memory usagge grows, so i guess that the main problem are textures being loaded in graphics card.
> Looking in the forum I found some interesting threads about using GLObjectVisitor, but this didnt solve the problem. I dont know if i did something wrong or just this was not the solution:
> struct CompileCallback : public osg::Camera::DrawCallback
> {
>        virtual void operator() (const osg::Camera& camera)
>        {
>                osgUtil::GLObjectsVisitor gov;
>                const_cast<osg::Camera&>(camera).accept(gov);
>        }
> };
> view->getCamera()->setPreDrawCallback(new CompileCallback);
> I also tried a solution given in this post:
> http://forum.openscenegraph.org/viewtopic.php?t=3330
> viewer->setIncrementalCompileOperation(new osgUtil::IncrementalCompileOperation());
> After viewer initialization (and before loadint the scene). The results where just the same.
> Is there any way to preload textures in graphics card? Any other sugestion?
> Thank you!
> Cheers,
> Joseba
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=19545#19545
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list