Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - androidman

Pages: [1]
1
Hi raft,

In my android game, i create multi AnimatedGroup from the same model and let all of them  animate continuously  at the same time. The problem is your slerp() function create so many Quaternion object in runtime, thus my game is slow down. Can you tell me how to reduce the number of Quaternion object or whatever to speed up my game?

I create AnimatedGroups at the same way with your bones example.

thank you so much.

2
Support / OutOfMemory error occurs when restart game
« on: May 23, 2011, 06:02:29 am »
Hi all,

When i start my game after the first time ( when it was installed), all the previously loaded graphic data(ex. texture, object3D, ....) is not erased and it  is loaded again and again  till the buffer OutOfMemory error occurs. After the error occurs, all data is erased. How to erased that data when exiting the game?

I am sorry if this is a very simple mistake!

3
Support / Out of memory when load 3ds file.
« on: March 17, 2011, 03:03:05 am »
Hi guys,

I created a teaport with 3ds Max, then export it to .3ds file.
On Android, i load that 3ds file to display. The teaport was displayed, but after a while, the error happened.

on LogCat, i saw this message appeared about 2116 times:

03-17 08:44:52.635: INFO/jPCT-AE(xxx): Additional visibility list (xxxx) created with size: 512

Here is my code:

Code: [Select]
package com.dlh.Second_jPCT;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.opengles.GL10;

import com.threed.jpct.Camera;
import com.threed.jpct.Config;
import com.threed.jpct.FrameBuffer;
import com.threed.jpct.Light;
import com.threed.jpct.Loader;
import com.threed.jpct.Matrix;
import com.threed.jpct.Object3D;
import com.threed.jpct.OcTree;
import com.threed.jpct.RGBColor;
import com.threed.jpct.SimpleVector;
import com.threed.jpct.Texture;
import com.threed.jpct.TextureManager;
import com.threed.jpct.World;
import com.threed.jpct.util.BitmapHelper;

import android.app.Activity;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.opengl.GLSurfaceView;
import android.opengl.GLSurfaceView.EGLConfigChooser;
import android.opengl.GLSurfaceView.Renderer;
import android.os.Bundle;
import android.util.Log;

public class Second_jPCT extends Activity {
   
GLSurfaceView glSurface;

World world;
FrameBuffer fb;
TextureManager ttman;
Camera cam;
Object3D terrain, teaport;
Light sun;

boolean first=true;
/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        glSurface= new GLSurfaceView(getApplication());
        glSurface.setRenderer(new MyRenderer());
       
        setContentView(glSurface);   
    }
    @Override
    protected void onPause() {
    // TODO Auto-generated method stub
        glSurface.onPause();
    super.onPause();
    }
    @Override
    protected void onResume() {
    // TODO Auto-generated method stub
        glSurface.onResume();
    super.onResume();
    }
    class MyRenderer implements Renderer{

@Override
public void onDrawFrame(GL10 arg0) {
// TODO Auto-generated method stub
fb.clear(new RGBColor(20,20,20));
world.renderScene(fb);
world.draw(fb);
}

@Override
public void onSurfaceChanged(GL10 arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
if(fb!=null){
fb.dispose();
}
fb= new FrameBuffer(arg0, arg1, arg2);
}

@Override
public void onSurfaceCreated(GL10 arg0, EGLConfig arg1) {
// TODO Auto-generated method stub

world= new World();
        world.setAmbientLight(30, 30, 30);
               
        Drawable image= getResources().getDrawable(R.drawable.rocks);
        Texture rock= new Texture(BitmapHelper.rescale(BitmapHelper.convert(image), 64, 64) );
        TextureManager.getInstance().addTexture("ground",rock);

AssetManager assMan = getResources().getAssets();
InputStream is= new InputStream() {

@Override
public int read() throws IOException {
// TODO Auto-generated method stub
return 0;
}
};
try {
is =  assMan.open("teaport.3ds", AssetManager.ACCESS_UNKNOWN);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Object3D[] objs= Loader.load3DS(is, 1);

if(objs.length>0){
teaport= objs[0];
teaport.setTexture("ground");
}
teaport.enableLazyTransformations();
world.addObject(teaport);
teaport.build();
teaport.strip();

         cam= world.getCamera();
         cam.setPosition(new SimpleVector(0,-5,0));
         cam.lookAt(teaport.getTransformedCenter());
         
         sun = new Light(world);
         sun.setIntensity(250, 250, 250);
         sun.setPosition(new SimpleVector(0,-20,0));
}
   
    }
   
}

how can resolve this?

Pages: [1]