开发者

Does Anyone know what is causing this GLThread Out of Memory Error?

开发者 https://www.devze.com 2023-02-01 04:53 出处:网络
I get 12-21 21:19:09.384: ERROR/Android开发者_JAVA百科Runtime(4063): java.lang.OutOfMemoryError Thanks!

I get 12-21 21:19:09.384: ERROR/Android开发者_JAVA百科Runtime(4063): java.lang.OutOfMemoryError

Thanks!

@Override
public void initScene() {


    //openOptionsMenu();
    //plane = new Box(1.5f,1.5f,1.5f);
    scene.addChild(plane);


    // Create a Bitmap. Here we're generating it from an embedded resource,
    // but the Bitmap could be created in any manner (eg, dynamically).

    Bitmap b = Utils.makeBitmapFromResourceId(this, R.drawable.clouds_alpha2b);

    // Upload the Bitmap via TextureManager and assign it a 

    Shared.textureManager().addTextureId(b, "battleback", false);

    // Unless you have a specific reason for doing so, recycle the Bitmap,
    // as it is no longer necessary.

    b.recycle();

    // Create a TextureVo using the textureId that was previously added 
    // to the TextureManager ("uglysquares").

    TextureVo texture = new TextureVo("battleback");

    // Add it to the TexturesList held by the Object3d, 
    // and it will be duly rendered.

    plane.textures().add(texture);
    plane.position().y = -.5f;
    plane.position().z = 0;
    plane.position().x = 0;

    plane.rotation().y -= 60;
    skyBox.rotation().y -= 60;

    skyBox.addTexture(SkyBox.Face.All, R.drawable.clouds_alpha2b, "mytexture");

    scene.addChild(skyBox);



    IParser parser = Parser.createParser(Parser.Type.MD2,
            getResources(), "com.thinknew.androidbattle:raw/blade", true);
    parser.parse();


    revenant = parser.getParsedAnimationObject();
    //revenant.position().x = -1;
    revenant.scale().x = revenant.scale().y = revenant.scale().z = .025f;
    revenant.rotation().z = -60;
    revenant.rotation().x = -90;
    revenant.position().x = -1;
    revenant.position().z = -1;

    revenant.setFps(20);
    revenant.animationEnabled();
    revenant.play("stand", true);

    scene.addChild(revenant);


    parser = Parser.createParser(Parser.Type.MD2, 
            getResources(), "com.thinknew.androidbattle:raw/blade", true);
    parser.parse();

    fatso = parser.getParsedAnimationObject();
    fatso.scale().x = fatso.scale().y = fatso.scale().z = .025f;
    fatso.rotation().z = -250;
    fatso.rotation().x = -90;
    fatso.position().x = 1;
    fatso.position().z = 1;

    fatso.setFps(20);
    fatso.animationEnabled();
    fatso.play("stand", true);

    scene.addChild(fatso);




    Light light = new Light();
    scene.lights().add(light);

    scene.camera().position.y = 2;
    scene.camera().position.x = -2;
    scene.camera().position.z = 5;
    scene.camera().target = new Number3d(0, 1, 0);

}



12-21 21:45:18.668: ERROR/libs3c2drender(1917): int S3c2DRender::DoG2D(unsigned int, s3c_img*, s3c_rect*, unsigned int, s3c_img*, s3c_rect*, int, int)::S3C_G2D_ROTATOR_18176 fail
12-21 21:45:50.763: ERROR/PowerManagerService(1917): CurLock p:3 mPS:1
12-21 21:45:50.763: ERROR/PowerManagerService(1917): type=SCREEN_DIM_WAKE_LOCK           'StayOnWhilePluggedIn Screen Dim' active (minState=1)
12-21 21:45:50.763: ERROR/PowerManagerService(1917): type=PARTIAL_WAKE_LOCK              'StayOnWhilePluggedIn Partial' active (minState=0)
12-21 21:47:08.768: ERROR/libs3c2drender(1917): int S3c2DRender::DoG2D(unsigned int, s3c_img*, s3c_rect*, unsigned int, s3c_img*, s3c_rect*, int, int)::S3C_G2D_ROTATOR_18176 fail
12-21 21:47:58.468: ERROR/dalvikvm-heap(4414): Out of memory on a 27232-byte allocation.


You should try using Dalvik Debug Monitor, in particular VM Heap and Allocation Tracker sections. That will give you more info on what is going on.

0

精彩评论

暂无评论...
验证码 换一张
取 消