A
A
Andrey Andryushchenko2015-04-18 17:00:35
Java
Andrey Andryushchenko, 2015-04-18 17:00:35

Why do textures turn black when I close the app?

When you exit the application with the android "back" system button and then enter the application, all textures are replaced with black rectangles. Why does this happen and how to avoid it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2015-04-18
@GavriKos

In android openGL, when folding, all textures are unloaded from video memory. When you turn, you need to restore them. You can also try caching and restoring from the cache.

K
Kirill Olenev, 2015-04-18
@agent10

First you need to understand where you get "pictures" for textures from and how you load them into a texture.
libgdx has a concept of managed and unmanaged textures.
Managed textures restore themselves. Such textures are usually loaded from the assets directory and libgdx itself reloads images into textures on restore.
You control unmanaged textures.
If the textures are dynamic, for example, you get pictures from the Internet, then you need to store the original Pixmap or Bitmap separately in memory from which you will update the texture again when restoring.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question