Has Precaching images changed?

Monkey Forums/Monkey Programming/Has Precaching images changed?

therevills(Posted 2015) [#1]
To precache images I normally draw them off the screen after loading them:

Class GameImage
	Field image:Image
	Field w:Int
	Field h:Int

	Method PreCache:Void()
		DrawImage (Self.image, -Self.w - 50, -Self.h - 50)
	End


But I can tell that some images are not getting precached to the GPU, as there is a slight pause before displaying them...

So I changed the Precache method to:
	Method PreCache:Void()
	DrawImage(Self.image, 100, 100)
	Cls
End


Which works better for HTML5 but for Android the slight pause is still there...

Any ideas?


Soap(Posted 2015) [#2]
Are you using texture atlases?


therevills(Posted 2015) [#3]
Yeah, a couple of them.


Paul - Taiphoz(Posted 2015) [#4]
as far as I know, at least as far as I have noticed its the same, just draw one sprite from each atlas at least once to get it on the gpu and you should be good, if there is a pause could it be the creation of the objects/lists for the first time?


marksibly(Posted 2015) [#5]
I haven't changed anything internally...


therevills(Posted 2015) [#6]
Wondering if its the size of the graphics I am using...

Background image: 1366x768
Sprites Atlas:    1224x1170
Other:
640x293
136x195
400x215
563x120
510x36
507x36
76x38
136x195
and more...


With HTML5 it does help that I "precache" directly to the viable screen than off screen. With Android I still get the stutter... I'll investigate some more tonight.


dawlane(Posted 2015) [#7]
Have you tried changing the image canvas size to a power of two?
And can the device handle those image sizes greater than 1024?


therevills(Posted 2015) [#8]
Have you tried changing the image canvas size to a power of two?

Not yet, I thought Mojo did that internally?
And can the device handle those image sizes greater than 1024?

It should, but I'll check. I had one image which was 2048x2048 and the device (Motorola G) ran out of memory when loading it via LoadImage, but when I separated the image up into 256x256 via LoadAnimImage it was fine.

Thanks for the suggestions.


Paul - Taiphoz(Posted 2015) [#9]
I get a little stutter with swim jelly swim on android let me know if you solve this.


Paul - Taiphoz(Posted 2015) [#10]
any word on this therevills ? you been able to either identify or solve the issue?


therevills(Posted 2015) [#11]
I've parked it for now, I need to get on with the rest of the game :)

I'll come back to it once I finished.