In concept, I am trying to solve an issue very similar to the one in this thread: http://irrlicht.sourceforge.net/forum/v ... p?p=214692
The solution proposed by vitek in this post is simple and certainly appears that it should work, however it does not.
http://irrlicht.sourceforge.net/forum/v ... 92#p214692
The problem is this line:
Code: Select all
myDisplayTexture = driver->addTexture(image->getFileName(), image);
This led me to look into the interface class implementations of driver::addTexture in Irrlicht/CNullDriver.cppLOAD PNG: can't read file
: minimap.png
Code: Select all
//! Creates a texture from a loaded IImage.
ITexture* CNullDriver::addTexture(const io::path& name, IImage* image, void* mipmapData)
{
if ( 0 == name.size() || !image)
return 0;
ITexture* t = createDeviceDependentTexture(image, name, mipmapData);
if (t)
{
addTexture(t);
t->drop();
}
return t;
}
Code: Select all
ITexture* CNullDriver::createDeviceDependentTexture(IImage* surface, const io::path& name, void* mipmapData)
{
return new SDummyTexture(name);
}
Any proposed alternative solutions? I'm guessing the original solution by vitek was created based by the documentation only, and not in practice -- otherwise I would expect that they would have encountered this problem when attempting to implement it with an IReadFile coming from an in-memory pseudofile.
The only solution I can think of at the moment is something like the second option in vitek's post, to copy the texture data manually. I'd quite like a cleaner solution like the first one, performance is not important in this particular use case. I suppose I might as well start pursuing that option until a better one comes up.
Irrlicht devs, is there a chance you can correct the behavior above where it appears that the intent of this addTexture implementation is to use the already-loaded IImage but the implementation does otherwise? That is the underlying problem here, and it ultimately is only compatible with one specific implementation of IReadFile (one where that filename actually exists on the filesystem in the expected location)