[osg-users] obj loader: map_* only reads last component

Robert Osfield robert.osfield at gmail.com
Wed Jul 23 13:43:18 PDT 2008

Hi Bob,

The code was written under the assumption that filenames wouldn't have
spaces...  to handle this one would need to add an extra method into
the parser to get from a specified position to the end of the line,
and do the stripping or extraneous spaces that you mentioned.  Feel
free to dive in and code such as solution.


On Wed, Jul 23, 2008 at 9:26 PM, Bob Kuehne <rpk at blue-newt.com> wrote:
> hi all,
> i recently was working with some .obj files (and associated .mtl files) and
> ran into the problem where the loader would truncate only the last component
> of a filename containing spaces. so, for example, in the .mtl file would be
> an entry like:
>  map_Kd my texture name.jpg
> which is valid under many filesystems, however, the loader would truncate it
> to just 'name.jpg' and of course, not resolve that (or resolve a wrong
> texture).
> so i did a little research, and the specifications for mtl seem to simply
> say that:
>  map_Kd filename
> is valid.
> my question is to whomever wrote the mtl file parser - why are the filenames
> truncated? i'd say the should be stripped (ie, ' my file name.jpg  ' should
> resolve to 'my file name.jpg') but never only the last component used.
> if that's the case, then i've got a patch ready to go.
> anyone?
> bob
> _______________________________________________
> 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