Hi Robert. I've recreated the problem as you said.
I've read a texture and write it to a bmp Twice.
IT WORKS

But in my app doesn't.
The second time I write, the Registry::loadLibrary
returns false:

 bool Registry::loadLibrary(const std::string& fileName)
{
      DynamicLibrary* dl = getLibrary(fileName);
      if (dl) return false;  <---- *HERE*

..
}

I made it WORK trying the code from the main window of my app.
I was calling writeImageFile from a non-modal Dialog under windows.
Maybe the problem is caused of the Thread nature of dialogs ?

I'll try to avoid making  these calls from dialog threads.

thanks !



Robert Osfield escribió:
> Hi Miguel,
>
> Something sounds amiss on your build, the whole ideal behind the
> instance() method is that it should manage a single instance that
> doesn't not get created.  I haven't heard reports of similar problems
> to what you describe, doing lots of read and writeNodeFile calls is
> pretty common usage model in the OSG so its something I would expect
> to hear lots of reports of problems if there was something serious
> lurking.
>
> Can you recreate the problem with one of the standard OSG examples?
> Is there anything unusual in the way you manage the OSG? i.e.
> loading/unloading of the OSG libraries such as via a dynamic plugin to
> a another application.
>
> I'd also check to make sure you don't have mixed versions of the OSG
> on your system, i.e. compiling against one version, but linking at
> runtime to another.
>
> Robert.
>
> On 7/27/07, Miguel Martinez <[EMAIL PROTECTED]> wrote:
>   
>> Hi all,
>>
>> I have an osg::Image wich I write to a file on disk.
>> I have to overwrite this same image several times in run time.
>> What I do Is call
>>
>> osgDB::writeImageFile(img, path)
>>
>> The first call the function succeeds, but all the other calls
>> it can't do it, because the loadLibrary function fails when tying
>> to load the bmp plugin.
>>
>> I've been tracing the code and seems that there's another
>> registry instance in memory (loaded in the first writeImageFile call)
>> wich is causing the loadLibrary to fail.
>>
>> the writeImageFile calls  Registry::instance()->writeImage(image,filename);
>>
>> and the instance() generates a new Registry each time.
>> The instance function has a "bool erase = false" to erase generated
>> instance after
>> the write operation, but I can't set it from writeImageFile call.
>>
>> However, the osgDB::writeNodeFile works OK writing to a same file several
>> times along the app runtime.
>>
>> Maybe storing a pointer to Registry::instance() at my app startup,
>>  and calling  registry_ptr->writeImage can solve temporarily the problem but
>> I think the function should behave the same as osgDB::writeNodeFile and
>> that's
>> why I post this message.
>>
>> Hope it helps!
>>
>>  // Miguel Martinez Rodilla
>> _______________________________________________
>> 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
>
>   

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to