hiteshsuthar / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Rokon TextureManager recycles (nukes) manually generated bitmaps on load and then cannot reload them on activity resume #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a texture for example from a mutable bitmap you generate
2. put your activity on background
3. resume it, the texture will be black

What is the expected output?

TextureManager should reload the bitmap into graphic memory

What do you see instead?

Black texture 

What version of Rokon are you using?

Head

On which version of Android are you experiencing this?
All.

Please provide any additional information below.

At load time, the texture manager recycles every bitmap given to it.
If it is an asset I suppose it is fine as it can find it back somehow from 
the original file. But in my case from a painted bitmap, it just nukes it 
for good... see below.

in loadTextures in TextureManager :

for(int j = 0; j < _loadQueue[i].getTextureArray().length; j++) {
                    if(_loadQueue[i].getTextureArray()[j] != 
null) {

if(_loadQueue[i].getTextureArray()[j].getType().getType() == 
TextureType.BYTEBUFFER) {
                            Debug.print("Copying in raw 
ByteArray texture");

gl.glTexSubImage2D(GL10.GL_TEXTURE_2D, 0, 
_loadQueue[i].getTextureArray()[j].getAtlasX(), 
_loadQueue[i].getTextureArray()[j].getAtlasY(), 
_loadQueue[i].getTextureArray()[j].getWidth(), 
_loadQueue[i].getTextureArray()[j].getHeight(), GL10.GL_RGBA, 
GL10.GL_UNSIGNED_BYTE, 
_loadQueue[i].getTextureArray()[j].getType().getBuffer());
                        } else {
                            bmp = 
_loadQueue[i].getTextureArray()[j].getBitmap();

GLUtils.texSubImage2D(GL10.GL_TEXTURE_2D, 0, 
_loadQueue[i].getTextureArray()[j].getAtlasX(), 
_loadQueue[i].getTextureArray()[j].getAtlasY(), bmp);
                            bmp.recycle(); // HERE, 
this nukes the generated texture, commenting out that solves my problem
                            bmp = null;
                        }
                    }
                }

Original issue reported on code.google.com by guillaum...@gmail.com on 10 May 2010 at 4:03

GoogleCodeExporter commented 8 years ago
Rokon 2 is on the way, all current Issues are obsolete

Original comment by rtaylor205@gmail.com on 24 May 2010 at 3:31