Patrik Müller wrote:
Hi Dirk,
no - you often have this problem if you use 3rd party libs - one example is
lib3ds. One solution would be using readFile API as Allen suggested - but
would you use it if you know this call is deprecated?
Actually, the API I used isn't the deprecated one. It is the read
method that takes a stream and a filenameOrExtension. It is meant to
work with streams, but in most use cases you can just pull the filename
from the second argument and use the file directly. The problem (as I
see it) is that using the second argument in this way is not guaranteed
to work (ie. it is non-standard and based more on a side-effect then a
documented use case).
That said, I still agree that this probably could happen a lot with 3rd
party libs. Most of them that I have seen do not use istreams for
reading data. :(
-Allen
Greets,
Patrik
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im Auftrag von Dirk
Reiners
Gesendet: Mittwoch, 25. Mai 2005 22:21
An: users
Betreff: Re: [Opensg-users] More loader questions
Hi Allen,
On Wed, 2005-05-25 at 10:22 -0500, Allen Bierbaum wrote:
I still haven't come up with a solution to dynamically loading
loaders, but I have come across a new issue.
The loader I am writing is using an external proprietary API. ie. I
have no source code and no control of the API.
The issue I am facing is that the external API does not support
streams, it only supports loading from a file name as a char*. Since
it seems that the readFile API for osg::SceneFileType is deprecated, I
am at a little bit of a loss as to what to do. From what I understand
of the SceneFileType API it looks like the read method takes 2 arguments:
1.
istream of data 2. filename or extension. I could just assume that
the 2nd param will always contain the filename and ignore the stream,
but this seems a little fragile. I know that this will definitely
break support for gziped files since that uses an ultra cool stream
adapter, but will it break anything else in how OpenSG assumes the file
loaders work?
No, that is a valid assumption. It all depends on the user. Most apps use
the filename interface and ignore the stream (this includes the
SceneViewer). I would just try to open the filename and if that fails print
an error message explaining the reason.
It seems that this would be something that others have probably faced
when interfacing with existing loader libraries (especially C-based
ones that would have no concept of streams). What have other people
done in this situation?
I'm not aware of other people using these kinds of libraries, so I'd guess
you're the first to have this problem.
HIH
Dirk
-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_idt02&alloc_id135&opÿick
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users