memory and gpu usage of a repeated texture?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By psear

I plan to use a parallax background, and to make it scroll infinitely, it will increase the size of the textures (which will be imported with repeat), my question is because the game is an infinite scroller. If you have a 10,000 x 800 pixel sprite, for example, which is just one 1000 x 800 sprite being tiled over and over as the terrain scrolls, what is the impact on gpu and memory? Is there any cost to having all this texture “off screen”?

:bust_in_silhouette: Reply From: jgodfrey

Ideally, you wouldn’t have vast amounts of off-screen textures just for infinite scrolling. A better approach would be to have just enough texture “chunks” to fill the screen with a little off-screen buffer at both ends. Then, when scrolling, as soon as one of the chunks has scrolled out of view (typically, off the left-edge of the screen), just move it to the end of set of textures (so, off of the right-hand edge of the screen). Just repeat this each time a chunk is no longer viewable.

That way, you just need enough chunks to fill the screen, plus a bit of buffer and you still get infinite scrolling…

Specifically to your question of “is there a cost to all the off screen textures”… While I’m sure the answer is Yes, I can’t really quantify what that cost might be…