PDA

View Full Version : white texture on iOS



osgoz
02-16-2012, 06:08 PM
Hello.

I'm new to the forum.
I'm learning ProtonSDK since one month ago.
I have been using Irrlicht on Windows platform and QT for years.

I'm having a problem.
When I load a texture form the local file system it's fine on windows and on iOS.
But when i load the same texture from a mounted zip file, on windows is fine but on iOS i have a nice white texture.
I'm seaching for days, but I have no luck.
The Only thing diferent from loading the texture from local file system or the zip file system, is that I use createMemoryReadFile from Irrlicht to create the Texture.

Have some one else see this thing.

I apologize for my poor English.

Regards.

Seth
02-16-2012, 10:07 PM
Hmm... I don't think I've ever mounted a zip under iOS.. but it should work.

Make sure you use Proton's zip mounting stuff, and not Irrlicht's. (It will interface with Irrlicht via CProtonReader automatically)

So you should be doing something like this in App.cpp:



FileSystemZip *pFileSystem = new FileSystemZip();
if (!pFileSystem->Init(GetBaseAppPath()+ "myfiles.zip"))
{
LogMsg("Error finding zip file to load resources");
}
// vector<string> contents = pFileSystem->GetContents();
// LogMsg("Listing all %d files.", contents.size());

// for (int i=0; i < contents.size(); i++)
// {
// LogMsg("%s", contents[i].c_str());
// }

GetFileManager()->MountFileSystem(pFileSystem);

Also, carefully check the log (while running in debug). If it still won't work, we'd probably need sample code to see demonstrate the problem.

osgoz
02-17-2012, 08:46 AM
Thank you for your quick reply.

Yes, that was my secong try.
I found, searching this forums, someone saying that irrlicht part for zips does not work fine on android, but Proton works ok. So I give a try exactly the same code you put and modify your CProtonReader.cpp file for testing porpouses only.


if (pBytes)
{

if (IsAPackedFile(pBytes)) //applicable to rttex files
{
//let's decompress it to memory before passing it back
unsigned int decompressedSize;
byte *pDecompressedData = DecompressRTPackToMemory(pBytes, &decompressedSize);
size = decompressedSize;
delete pBytes; //done with the original
pBytes = pDecompressedData;
}else{
byte count = *pBytes;
byte* pTmp = pBytes;
size -= count;
pTmp++;

while(count > 0){
pTmp++;
count--;
}

byte *pData = new byte[size +1];
memset(pData,0x0,size+1);
memcpy(pData,pTmp,size);
delete pBytes; //done with the original
pBytes = pData;

}

return io::createMemoryReadFile(pBytes, size, filename, true);

I only do a simple displacement of a .jpg file.
In the log window it's said "Loaded texture: Lib/arch/Material/High/cream1.pgj" for example, so all went ok.
The log show the same on iOS too.
But on windows works fine and on iOS do same thing that using irrlicht file system, a white texture.
I will try using your rttex files on a zipped one.

--- Edit ----
I have just try with your .rttex files on a zipped file and works fine on windows and iOS.
So I suppose that is my part of toying with memory what is wrong on iOS, or at least iOS does not like it.
------------------------


--- Edit 2 ----
I'm sorry.
It's my fault.
The textures where not pow of 2 x pow of 2 pixels.
They are 100x100 pixels.
I does not recall that I was on OGL ES.
I rescaled then to 128x128 and now works fine on windows and iOS.
Sorry to make you loose your time.
------------------------

Regards