0
\$\begingroup\$

I have found a similar question here, but it is about playing sounds.

I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game execution, causes a considerable lag. The lag doesn't appears for the next times.

Someone has faced this problem before? What can I do to overcome this?

Update:

I inserted a code in the end of content load routine that draws EVERY Texture2D that is loaded into ContentManager before follow to the game screen. This works well. None lag occurs when different textures are rendered over the time, EXCEPT if the IsFullScreen are changed. Apparently, changing this property makes the textures loaded in the GPU gone. Is that correct?

\$\endgroup\$
5
  • 4
    \$\begingroup\$ Do you load the textures when you draw them for the first time? If you do, try loading them for example when the level/game loads. \$\endgroup\$
    – user9790
    Oct 27, 2013 at 14:30
  • \$\begingroup\$ When the game starts all at the same time. \$\endgroup\$
    – Emir Lima
    Oct 27, 2013 at 15:10
  • \$\begingroup\$ Have you tried the answers to the linked question? It seems like a reasonable plan for textures, as well. \$\endgroup\$ Oct 27, 2013 at 15:16
  • 1
    \$\begingroup\$ I think this behaviour has relation to the moment the Texture is sent to the Graphics Card. What I can try based in that answers is execute a spriteBatch.Draw() for every texture loaded by the ContentManager, but this is weird. :P \$\endgroup\$
    – Emir Lima
    Oct 28, 2013 at 14:20
  • 1
    \$\begingroup\$ Switching to full screen likely causes a Reset of the graphics device, which will require that all textures be sent to the GPU again. msdn.microsoft.com/en-us/library/… \$\endgroup\$ Oct 30, 2013 at 17:28

0

You must log in to answer this question.

Browse other questions tagged .