Android OpenGL: Possibly Running Out Of Memory?

Problems with Canvas, OpenGL, etc...

Android OpenGL: Possibly Running Out Of Memory?

Postby ChrisB2404 » Sat Feb 04, 2012 5:01 pm

I have been trying to fix this issue for weeks but I'm at the point where I dont know what to do now.

I think that some Android devices dont have enough memory to load the amount of textures, although it could be something else causing the issue, as I said I really dont know what to do with this.

There are 28 PNG's being loaded all 1024x1024 which come to a total of 4.8megs. Below is the OpenGL method for loading textures

Code: Select all
  GL10 gl = glGraphics.getGL();
    int[] textureIds = new int[1];
    gl.glGenTextures(1, textureIds, 0);
    textureId = textureIds[0];

    InputStream in = null;
    try {
        in = fileIO.readAsset(fileName);
        Bitmap bitmap = BitmapFactory.decodeStream(in);
        gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);
        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
        setFilters(GL10.GL_LINEAR , GL10.GL_LINEAR);
        gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
        width = bitmap.getWidth();
        height = bitmap.getHeight();
    } catch(IOException e) {
        throw new RuntimeException("Couldn't load texture '" + fileName +"'", e);
    } finally {
        if(in != null)
            try { in.close(); } catch (IOException e) { }

There are no issues on my Desire HD, but on a HTC Cha Cha a lot of textures dont appear at all and on a Galaxy S two textures just appear white. The Cha Cha throws this error while loading textures

02-04 15:46:28.907: E/Adreno200-ES20(1501): override1= 0xfffffffe, override2= 0xfff *

Oddly if the Cha Cha is locked (OpenGL textures are destroyed) and then unlocked (reloaded textures) the particular textures that were not there initally are now, however different textures are now not visable.

Is this a memory issue? If so is there a way around this?

Once Poster
Once Poster
Posts: 1
Joined: Sat Feb 04, 2012 4:59 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 1 guest