Allen Bierbaum wrote:
> In one of our applications we need to cache some image data.  Right now 
> we are caching it as jpg files but I would really like to cache it in a 
> faster pure binary form for OpenSG.  The brought up the obvious idea of 
> using .osb files.  The way the osb reader/writer works functions mainly 
> on field container anyway so I thought it would be a no-brainer to get 
> working.  Unfortunately it looks like the interface is tied to the idea 
> of saving node fc's (and any fc's that are part of the tree linking from 
> that node).
>
> So my question is this, would it be possible to modify the osb 
> reader/writer to support field containers in general or can anyone 
> suggest an alternative way to do something like this?
>   
I've used the NFIO classes to write images in osb, like this:

bool OSGImageCacher::doWrite(std::ostream& os)
{
        return OSG::NFIOBase::writeFC(m_image, os, "");
}

I then read them back like this:

      OSG::FieldContainerPtr fc = OSG::NFIOBase::readFC(is, "");
        if (!fc) {
            s_log.err("OpenSG failed to read '%s'", path.string().c_str());
            return false;
        }
        m_image = OSG::ImagePtr::dcast(fc);

Cheers,
/Marcus

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to