Image Loading/Usage Delay Quirk!

Monkey Targets Forums/Android/Image Loading/Usage Delay Quirk!

ElectricBoogaloo(Posted 2013) [#1]
Sorry for the odd title, wasn't sure what to call this!
I've just noticed an odd bug, whilst bulking up NeonPlat on OUYA.
Actually, I first noticed it WAY way back in February when adding Badges/Awards to an Android game, but since most of my games tend to use two or three images (and that's about it!) it wasn't really much of an issue.

Today, I'm attempting to use about 20 spritesheets, and the delay has once again reappeared.

It seems that, somewhere in Android, there's a delay between "LoadImage" and "DrawImage", which only occurs the first time you try to draw an image.
I'm unsure if this is Monkey or Android, but it's really noticable when you've got a whole pile of different images to draw.

I'd recommend a "Load one image per frame, and immediately draw it to the screen with Alpha(0)" method for loading images, so as to avoid this odd quirk.

For what it's worth, I just tried "Load all the images, then spit them all onto the screen at once" and the game crashed, so.. one at a time!!


Gerry Quinn(Posted 2013) [#2]
I seem to remember this coming up before. If I recall correctly, loading images just gets them into standard RAM, and only when you draw them do they get pushed to video memory. I think it just applies to Android, among the main platforms anyway.


therevills(Posted 2013) [#3]
Yep, Gerry is correct. There is a slight delay when loading the image onto the GPU bus.

When loading the images via LoadImage I then normally just draw the images off screen so when I actually need them they are already on the GPU.

This issue can occurs on any platform which uses the GPU.


Wylaryzel(Posted 2013) [#4]
This thread was a real life saver for me and saved alot of time searching the need.

During the weekend I had time to incorporate the several texture atlas into my new game. Up to then, it was running very well and fast. As soon as I loaded all the image I got hickups during some time in the game. I was already thinking that there were some texture switches going on.

As soon as I started to draw at least one image of the atlas once during the loading screen, no hickups are there anymore :-) and the heapsize is reduced compared to the former build.

Big thanks :-)