Hi Charles

On Jan 15, 2008 3:30 AM, Charles Han <[EMAIL PROTECTED]> wrote:
> I want to preload models' textures before the models are visible in my
> application because when loading these textures, even though i enabled NPOT,
> the application freezes for a while.

You can try a very simple approach: disable all writes to the various
buffers during the first frame. This will force your driver to upload
everything to the graphics adapter.

For instance if you only use a depth buffer (and of course a color
buffer) you can do:
topNodeStateSet->setAttributeAndModes(new
osg::ColorMask(false,false,false,false), osg::StateAttribute::ON);
topNodeStateSet->setMode(GL_DEPTH_WRITEMASK, osg::StateAttribute::OFF);
For this purpose you can even create a special object that contain all
of your textures if there are not too many of them.

Of course, this works if all of your scene is loaded when you perform
this operation (i.e. nodes added afterwards will still freeze the app
for a small amount of time) so it is adapted to static scenes.

Dynamic scenes can be loaded in the background using an RTT camera.
Have a look at the osgprerender example for this. Playing with the
threading models (and perhaps with the CompositeViewer) you can
achieve parallel scene pre-rendering.

Regards

Thibault


> This is probably an old question but i really need a bit more details on it.
> i found some solutions like using osg::Camera pre draw callback but i could
> not find any examples related to.
>
> If anyone could give me an example, I'll appreciate it.
>
> Thanks
>
> Charles
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to