views:

60

answers:

2

We are building a scrollable background, and currently have one large background image that we split up into 512x512 tiles, and want to load these tiles as they are needed, instead of all at once, when calling GLUtils.texImage2D within onDrawFrame, we have noticeable lag we think because of having to load the texture onto the hardware, is there a better way to do this?

Thanks.

+1  A: 

Use texSubImage2D() to reload existing texture objects instead of creating entirely new ones.

genpfault
A: 

G'day buddy, I think the sheer amount of image data you're trying to transfer within a frame time is a tad much: if you are using a 24bpp format, 512x512 amounts to 1 MB of data. I can think of two ways to minimize it:

  • Change to a bitmap format that has less bpp. If you are using ARGB8888 you might want to try switching to RGB565 (as it is a background) to halve the data.
  • Consider splitting up the 512x512 into e.g. 4 chunks of 512x128 (since you are scrolling vertically). This way you distribute the loading over more frame intervals.

Cheers, Aert.

Aert
This worked the best, texSubImage2D seems as expensive of a call as texImage2D is, at least on Android, Nexus One.
Kevin D