PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Loading resources..

RapchikProgrammer · 18 Sep 2009, 18:05 UTC
Hey, i am trying to load resources using edgelib and all in game and menu resources are working fine.. but before the menu, im loading up some really heavy images of a full screen animation with each frame 320x240 or 640x480 according to the mobile res.. firslty is there any better way to load such animations then an animation strip using edgelib? secondly, when loading these animations the progress bar loads up like 5 of the 6 images and the load function of my game is then exited and restarted after which it continues and loads fully.. i think its getting out of space first and then falling back to some other method.. can you tell what this other method is so that i can set it from the beginning and avoid the user from having to wait for two load ups..
Hi,

For a fullscreen animation with seperate images (video?) I recommend a different approach:
- Store your images seperately, each screen is a seperate image (for example, frame000.png, frame001.png, etc.)
- Save a list of images in a package, use PackContainFiles to determine how many frames you have
- Use streaming, keep only one image in memory. Load the image matching the current frame (don't load it when it's already loaded)
- To increase package access speed, use PackBuildIndex
RapchikProgrammer · 24 Sep 2009, 18:08 UTC
I tried using videos, but our project is cross platform so it very hardwork to play the videos on all platforsm.. secondly videos degrade the quality a lot and take a lot of space if you try to keep quality..

i tried using packs.. our game is also on htc touch diamond, and as a stress test i tried it there first at the 640x480 res.. but the animation is very slow.. its really jaggy, as after rendering one frame it goes off to take another which takes up a lot of time.. and i am using a build index..
Hi,

Please try to store the images as loose files as well, do you notice a speed difference between using packages and loose files?

The bottleneck could either be the surface loading or file reading. In some cases, storing less bytes on disk and using more processor power (for example, to decompress) can be faster.

Can you tell me if you're loading your images from an SD card (those are generally slower)?
RapchikProgrammer · 28 Sep 2009, 18:54 UTC
I tried loose files at first but then it stuck after each frame, to load the next one.. very inefficient.. its better than that but still very jerky.. i am using htc touch diamonds device storage which should be faster.. and i am using jpegs, suggest any other format? but space is an issue as well so pngs just dont cut it for full res frames..
Hi,

JPEG files can take time to decode. If space wasn't an issue I would suggest using PNG's or BMP's compressed in a package file. Perhaps you could disable compression when adding the JPEG files to the package (if you haven't done so already)?

Alternatively you may want to create a file format yourself by saving just the raw data in the right colordepth. For Windows Mobile you could store each pixel as 2 bytes and directly load it into a surface (by locking surface data and reading file data to it).

If you're targetting OpenGL ES, perhaps you can use compressed textures (PVRTC), these are only supported on PowerVR hardware.
RapchikProgrammer · 01 Oct 2009, 05:06 UTC
I tried pngs too, they also become time consuming and are impractical because one animation of 43 frames of 640x480 goes to round 12.8mb.. and i am not using opengl.. i had to remove all full screen animations and go with static images for my current project due to time constraints, if u have a better way of loading full screen animation please let me know here or mail me at:

umar.nizamani <at> hotmail <dot> com
Hi,

I dig up this subject to get some information on PVRTC textures which you advice on using here (wherever those are supported, eg on iPhone OS if I am not wrong).

How do you use those in EdgeLib ? I think one needs to register the Loader in edgemain.h, since it's described as disabled in the ChangeLog, but whet's next ?

Also, I read somewhere that we should prefer using 1024x1024 patchworks of textures and blit from them than (for example) 4 textures of 512x512, is that right in your experience ?

Thanks,

Philippe
Hi Namal,

Registering the loader should be enough, the CreateSurface function will pick up this file format automatically (like it does for PNG for example). After the surface has been created, upload it to OpenGL afterwards.

The big difference between PVRTC and normal surfaces is that you can't access pixel data of PVRTC surfaces directly.
Hey There,

Hope you all had a great holiday season.

I go back to PVR files loading and plugin registration.

What I did was add the following code to
bool RegisterDisplayLoaders(ClassEDisplay *display)
in edgemain.h
Code:

ELoader_PVR *pvr = new ELoader_PVR;
if (pvr == NULL)
return(false);
if (!display->RegisterLoader(pvr))
{
delete pvr;
return(false);
}

But the linker gives me the following error :
"vtable for ELoader_PVR", referenced from:
__ZTV11ELoader_PVR$non_lazy_ptr in edge_mainclass.o

I obviously must do something wrong, but didn't find where ?

Thanks a bunch,

Phil
Hi Namal,

Hmm, that's not right. Can you tell me which EDGELIB release and platform (library) you're using?
Hey,
Thanks for the quick answer.

Edge is 3.97 (we will licence in a few weeks and be able get 3.98).
I tried to build for iphone-Simulator Debug and iphone Release with same error.

Best,
Hi,

Thanks for testing, we will fix this issue in the upcoming EDGELIB release.
Hi,

Any hint on when will this release be coming, we are a bit tight on schedule, and would like to either be able to decide on waiting or taking counter-measures. Is this already fixed in the 3.98 ?

Best,
Hi Namal,

A new hotfix will be created very soon, unfortunately it's not in version 3.98 yet.