www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: jms on December 10, 2010, 09:29:25 am

Title: clear data
Post by: jms on December 10, 2010, 09:29:25 am
Hi,
I have a similar problem to post the 12th October "Not Able to clear the data, but can not get me work.

I'm using the libraries in a live wallpaper. If I give a set wallpaper, before it has finished generating the scene and show the preview, then either make an application crash or shows me with malformed elements. For example, a textured Primitives.getPlane, I get only a blank background.

I put the trick mentioned in this post, before this code called by OnDestroy, but does not work:

if(world!=null){
            world.removeAll();
            world.dispose();
            world = null;
}

could someone help me? thanks!
Title: Re: clear data
Post by: EgonOlsen on December 10, 2010, 10:52:39 am
I don't see a relation between your problem and the post you are refering to. Can you explain what you do in a little more detail? Apart from that: This workaround isn't needed anymore.
Title: Re: clear data
Post by: jms on December 10, 2010, 11:56:59 am
Hi,

When you choose the wallpaper to see it, takes a few seconds to display, if before the end I give the button Set wallpaper for my screen, then crash the application.

For the logs I'm seeing, it looks as if it began to remove items before calling internally and to clean onDestoy world. I do not know if there is a way to stop all creation environment before it is finished. I do not know exactly how to explain.

Thanks.
Title: Re: clear data
Post by: EgonOlsen on December 10, 2010, 10:21:11 pm
I still don't get it... ???
Title: Re: clear data
Post by: Kaiidyn on December 13, 2010, 10:19:59 pm
if(object != null){ remove object; } in your cleanup.
Title: Re: clear data
Post by: Alexey on August 08, 2011, 10:16:33 am
I have the same problem, second run onCreateEngine() of wallpaper service crash;
Somebody can tell right initialization/destroy sequence?
I try next -
 
Code: [Select]
onCreateEngine()  {
       return = new MyEngine();
}
//in engine
onCreate(){
      executor = Executors.newSingleThreadExecutor();
}
onDestroy(){
  executor.shutdownNow();
  super.onDestroy();
}
onSurfaceCreated(){
      //init gl/egl
                        EGLConfig config = null;
egl = (EGL10) EGLContext.getEGL();
glDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
egl.eglInitialize(glDisplay, version);
int[] configSpec = new int[]{EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE};// {EGL10.EGL_RED_SIZE, 5, EGL10.EGL_GREEN_SIZE, 6, EGL10.EGL_BLUE_SIZE, 5, EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE};
EGLConfig[] configs = new EGLConfig[1];
int[] numConfig = new int[1];
egl.eglChooseConfig(glDisplay, configSpec, configs, 1, numConfig);
config = configs[0];

glc = egl.eglCreateContext(glDisplay, config, EGL10.EGL_NO_CONTEXT, null);
glSurface = egl.eglCreateWindowSurface(glDisplay, config, holder, null);
egl.eglMakeCurrent(glDisplay, glSurface, glSurface, glc);
gl = (GL10) (glc.getGL());
//create renderer
renderer = new MyRenderer();
renderer.onSurfaceCreated(gl, config);
//in renderer.onSurfaceCreated   create word, textures objects etc
}
onSurfaceDestroyed(final SurfaceHolder holder) {
super.onSurfaceDestroyed(holder);
egl.eglMakeCurrent(glDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
egl.eglDestroySurface(glDisplay, glSurface);
egl.eglDestroyContext(glDisplay, glc);
egl.eglTerminate(glDisplay);
mVisible = false;
}
// on surfaceChange & onVisibilityChanged has only logic for call draw command in executor

Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 10:48:14 am
What kind of "crash"?
Title: Re: clear data
Post by: Alexey on August 08, 2011, 11:07:58 am
ERROR/Surface(239): surface (id=0, identity=22) is invalid, err=-19 (No such device)
and black screen wallpaper
Title: Re: clear data
Post by: Alexey on August 08, 2011, 11:27:41 am
What i should destroy from jpct part in  onSurfaceDestroyed() of Engine ?
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 12:17:49 pm
Android destroys the gl context und surfaces itself. The engine contains no code to deal with that and it doesn't have to. What you can do in the engine, is to clean up some memory or maybe unload data from the gpu as long as the context is still valid, but that can't cause nor avoid your problem. Your problem seems to be related somehow to your surface setup code and that's out of the scope of jPCT-AE.
Title: Re: clear data
Post by: Alexey on August 08, 2011, 08:56:12 pm
Now, when i go to preview wallpaper 2nd time, i have java.lang.OutOfMemoryError.
Code: [Select]
08-08 21:42:01.784: INFO/jPCT-AE(22421): OpenGL vendor:     Qualcomm
08-08 21:42:01.784: INFO/jPCT-AE(22421): OpenGL renderer:   Adreno 205
08-08 21:42:01.784: INFO/jPCT-AE(22421): OpenGL version:    OpenGL ES-CM 1.1
08-08 21:42:01.794: INFO/jPCT-AE(22421): OpenGL renderer initialized (using 2 texture stages)
08-08 21:42:01.814: INFO/jPCT-AE(22421): Subobject of object 379/object381 compiled to flat fixed point data using 384 vertices in 3ms!
08-08 21:42:01.814: INFO/jPCT-AE(22421): Object 379/object381 compiled to 1 subobjects in 12ms!
08-08 21:42:01.814: INFO/jPCT-AE(22421): Object 'object381' uses one texture set!
08-08 21:42:01.824: INFO/jPCT-AE(22421): Subobject of object 381/object383 compiled to flat fixed point data using 384 vertices in 4ms!
08-08 21:42:01.824: INFO/jPCT-AE(22421): Object 381/object383 compiled to 1 subobjects in 10ms!
08-08 21:42:01.824: INFO/jPCT-AE(22421): Object 'object383' uses one texture set!
08-08 21:42:01.824: INFO/jPCT-AE(22421): [ 1312828921830 ] - WARNING: Object object385 hasn't been build yet. Forcing build()!
08-08 21:42:01.864: INFO/jPCT-AE(22421): Subobject of object 383/object385 compiled to flat fixed point data using 4110 vertices in 5ms!
08-08 21:42:01.864: INFO/jPCT-AE(22421): Object 383/object385 compiled to 1 subobjects in 35ms!
08-08 21:42:01.864: INFO/jPCT-AE(22421): [ 1312828921866 ] - WARNING: Object object387 hasn't been build yet. Forcing build()!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Subobject of object 385/object387 compiled to flat fixed point data using 3510 vertices in 5ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Object 385/object387 compiled to 1 subobjects in 19ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Subobject of object 387/object389 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Object 387/object389 compiled to 1 subobjects in 3ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Object 'object389' uses one texture set!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Subobject of object 389/object391 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Object 389/object391 compiled to 1 subobjects in 2ms!
08-08 21:42:01.884: INFO/jPCT-AE(22421): Object 'object391' uses one texture set!
08-08 21:42:01.884: INFO/jPCT-AE(22421): [ 1312828921892 ] - WARNING: Object object393 hasn't been build yet. Forcing build()!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Subobject of object 391/object393 compiled to flat fixed point data using 366 vertices in 1ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Object 391/object393 compiled to 1 subobjects in 2ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): [ 1312828921896 ] - WARNING: Object object395 hasn't been build yet. Forcing build()!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Subobject of object 393/object395 compiled to flat fixed point data using 264 vertices in 1ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Object 393/object395 compiled to 1 subobjects in 2ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Subobject of object 395/object397 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Object 395/object397 compiled to 1 subobjects in 2ms!
08-08 21:42:01.894: INFO/jPCT-AE(22421): Object 'object397' uses one texture set!
08-08 21:42:01.904: INFO/jPCT-AE(22421): Subobject of object 397/object399 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.904: INFO/jPCT-AE(22421): Object 397/object399 compiled to 1 subobjects in 4ms!
08-08 21:42:01.904: INFO/jPCT-AE(22421): Object 'object399' uses one texture set!
08-08 21:42:01.904: INFO/jPCT-AE(22421): [ 1312828921907 ] - WARNING: Object object401 hasn't been build yet. Forcing build()!
08-08 21:42:01.924: INFO/jPCT-AE(22421): Subobject of object 399/object401 compiled to flat fixed point data using 4110 vertices in 5ms!
08-08 21:42:01.924: INFO/jPCT-AE(22421): Object 399/object401 compiled to 1 subobjects in 21ms!
08-08 21:42:01.924: INFO/jPCT-AE(22421): [ 1312828921928 ] - WARNING: Object object403 hasn't been build yet. Forcing build()!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Subobject of object 401/object403 compiled to flat fixed point data using 3510 vertices in 5ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Object 401/object403 compiled to 1 subobjects in 19ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Subobject of object 403/object405 compiled to flat fixed point data using 384 vertices in 2ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Object 403/object405 compiled to 1 subobjects in 3ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Object 'object405' uses one texture set!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Subobject of object 405/object407 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Object 405/object407 compiled to 1 subobjects in 3ms!
08-08 21:42:01.944: INFO/jPCT-AE(22421): Object 'object407' uses one texture set!
08-08 21:42:01.944: INFO/jPCT-AE(22421): [ 1312828921954 ] - WARNING: Object object409 hasn't been build yet. Forcing build()!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Subobject of object 407/object409 compiled to flat fixed point data using 366 vertices in 1ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Object 407/object409 compiled to 1 subobjects in 2ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): [ 1312828921957 ] - WARNING: Object object411 hasn't been build yet. Forcing build()!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Subobject of object 409/object411 compiled to flat fixed point data using 264 vertices in 0ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Object 409/object411 compiled to 1 subobjects in 2ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Subobject of object 411/object413 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Object 411/object413 compiled to 1 subobjects in 2ms!
08-08 21:42:01.954: INFO/jPCT-AE(22421): Object 'object413' uses one texture set!
08-08 21:42:01.964: INFO/jPCT-AE(22421): Subobject of object 413/object415 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:01.964: INFO/jPCT-AE(22421): Object 413/object415 compiled to 1 subobjects in 3ms!
08-08 21:42:01.964: INFO/jPCT-AE(22421): Object 'object415' uses one texture set!
08-08 21:42:01.964: INFO/jPCT-AE(22421): [ 1312828921966 ] - WARNING: Object object417 hasn't been build yet. Forcing build()!
08-08 21:42:01.984: INFO/jPCT-AE(22421): Subobject of object 415/object417 compiled to flat fixed point data using 4110 vertices in 6ms!
08-08 21:42:01.984: INFO/jPCT-AE(22421): Object 415/object417 compiled to 1 subobjects in 20ms!
08-08 21:42:01.984: INFO/jPCT-AE(22421): [ 1312828921987 ] - WARNING: Object object419 hasn't been build yet. Forcing build()!
08-08 21:42:01.994: INFO/jPCT-AE(22421): Subobject of object 417/object419 compiled to flat fixed point data using 3510 vertices in 4ms!
08-08 21:42:01.994: INFO/jPCT-AE(22421): Object 417/object419 compiled to 1 subobjects in 14ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Subobject of object 419/object421 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Object 419/object421 compiled to 1 subobjects in 5ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Object 'object421' uses one texture set!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Subobject of object 421/object423 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Object 421/object423 compiled to 1 subobjects in 2ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Object 'object423' uses one texture set!
08-08 21:42:02.004: INFO/jPCT-AE(22421): [ 1312828922010 ] - WARNING: Object object425 hasn't been build yet. Forcing build()!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Subobject of object 423/object425 compiled to flat fixed point data using 366 vertices in 1ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): Object 423/object425 compiled to 1 subobjects in 3ms!
08-08 21:42:02.004: INFO/jPCT-AE(22421): [ 1312828922013 ] - WARNING: Object object427 hasn't been build yet. Forcing build()!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Subobject of object 425/object427 compiled to flat fixed point data using 264 vertices in 2ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Object 425/object427 compiled to 1 subobjects in 4ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Subobject of object 427/object429 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Object 427/object429 compiled to 1 subobjects in 3ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Object 'object429' uses one texture set!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Subobject of object 429/object431 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Object 429/object431 compiled to 1 subobjects in 2ms!
08-08 21:42:02.014: INFO/jPCT-AE(22421): Object 'object431' uses one texture set!
08-08 21:42:02.014: INFO/jPCT-AE(22421): [ 1312828922024 ] - WARNING: Object object433 hasn't been build yet. Forcing build()!
08-08 21:42:02.034: INFO/jPCT-AE(22421): Subobject of object 431/object433 compiled to flat fixed point data using 4110 vertices in 6ms!
08-08 21:42:02.034: INFO/jPCT-AE(22421): Object 431/object433 compiled to 1 subobjects in 19ms!
08-08 21:42:02.034: INFO/jPCT-AE(22421): [ 1312828922044 ] - WARNING: Object object435 hasn't been build yet. Forcing build()!
08-08 21:42:02.054: INFO/jPCT-AE(22421): Subobject of object 433/object435 compiled to flat fixed point data using 3510 vertices in 4ms!
08-08 21:42:02.054: INFO/jPCT-AE(22421): Object 433/object435 compiled to 1 subobjects in 17ms!
08-08 21:42:02.054: INFO/jPCT-AE(22421): Subobject of object 435/object437 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.054: INFO/jPCT-AE(22421): Object 435/object437 compiled to 1 subobjects in 2ms!
08-08 21:42:02.054: INFO/jPCT-AE(22421): Object 'object437' uses one texture set!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Subobject of object 437/object439 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Object 437/object439 compiled to 1 subobjects in 3ms!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Object 'object439' uses one texture set!
08-08 21:42:02.064: INFO/jPCT-AE(22421): [ 1312828922068 ] - WARNING: Object object441 hasn't been build yet. Forcing build()!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Subobject of object 439/object441 compiled to flat fixed point data using 366 vertices in 1ms!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Object 439/object441 compiled to 1 subobjects in 3ms!
08-08 21:42:02.064: INFO/jPCT-AE(22421): [ 1312828922072 ] - WARNING: Object object443 hasn't been build yet. Forcing build()!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Subobject of object 441/object443 compiled to flat fixed point data using 264 vertices in 1ms!
08-08 21:42:02.064: INFO/jPCT-AE(22421): Object 441/object443 compiled to 1 subobjects in 2ms!
08-08 21:42:02.074: INFO/jPCT-AE(22421): Subobject of object 443/object445 compiled to flat fixed point data using 384 vertices in 1ms!
08-08 21:42:02.074: INFO/jPCT-AE(22421): Object 443/object445 compiled to 1 subobjects in 3ms!
08-08 21:42:02.074: INFO/jPCT-AE(22421): Object 'object445' uses one texture set!
08-08 21:42:02.074: ERROR/dalvikvm-heap(22421): 4608-byte external allocation too large for this process.
08-08 21:42:02.074: ERROR/dalvikvm(22421): Out of memory: Heap Size=16859KB, Allocated=16593KB, Bitmap Size=8491KB, Limit=21884KB
08-08 21:42:02.074: ERROR/dalvikvm(22421): Trim info: Footprint=16967KB, Allowed Footprint=17095KB, Trimmed=1248KB
08-08 21:42:02.074: WARN/OSMemory(22421): External allocation of 4608 bytes was rejected
08-08 21:42:02.084: WARN/dalvikvm(22421): threadid=9: thread exiting with uncaught exception (group=0x40025a70)
08-08 21:42:02.094: ERROR/AndroidRuntime(22421): FATAL EXCEPTION: GLThread 12
        java.lang.OutOfMemoryError
        at org.apache.harmony.luni.platform.OSMemory.malloc(Native Method)
        at org.apache.harmony.luni.platform.PlatformAddressFactory.alloc(PlatformAddressFactory.java:150)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:66)
        at java.nio.ReadWriteDirectByteBuffer.<init>(ReadWriteDirectByteBuffer.java:51)
        at java.nio.BufferFactory.newDirectByteBuffer(BufferFactory.java:93)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:68)
        at com.threed.jpct.CompiledInstance.fill(CompiledInstance.java:704)
        at com.threed.jpct.Object3DCompiler.compile(Object3DCompiler.java:136)
        at com.threed.jpct.World.compile(World.java:2051)
        at com.threed.jpct.World.renderScene(World.java:1093)
        at com.ua.cv.abel.dna.wallpaper.DnaRenderer.onDrawFrame(MyRenderer.java:272)
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 09:14:29 pm
Is this code:

Code: [Select]
if(world!=null){
            world.removeAll();
            world.dispose();
            world = null;
}

still in place and called?
Title: Re: clear data
Post by: Alexey on August 08, 2011, 09:29:10 pm
this method now used for clearing. I refactor some in object building (use clone) and now on 4th running  memory out, so objects dont removing
Code: [Select]
public void release() {
System.out.println("Clear renderer");
if (world != null) {
world.dispose();
world = null;
}
if (fb != null) {
fb.dispose();
fb = null;
}
}
Title: Re: clear data
Post by: Alexey on August 08, 2011, 09:33:11 pm
aaaaaaaaaaaaaaaaaaaaaaa, i forgot world.removeAll(); :)  , trying with it
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 09:34:35 pm
I was about to suggest this... ;)
Title: Re: clear data
Post by: Alexey on August 08, 2011, 09:45:23 pm
... only 4 running, the same.  :'(  I try
Code: [Select]
TextureManager tm = TextureManager.getInstance();
Set<String> names = tm.getNames();
if (names != null && !names.isEmpty()){
for (String name : names){
tm.removeTexture(name);
}
}
but then, when textures remove and next create command trying set their - throw exception about textures allredy exists.
How i can clear TM singleton ?
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 09:50:14 pm
The question is: Why would you do that? Actually, you don't have to. Just load the textures once and don't touch the manager's content afterwards. Just make sure that you don't load them on each new surface creation. But to answer your question: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/TextureManager.html#flush() (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/TextureManager.html#flush()). Ignore the comment about applet in the Javadoc of that method. It's a porting flaw from desktop jPCT. I'll remove it.

Title: Re: clear data
Post by: Alexey on August 08, 2011, 09:56:39 pm
dont help.
if use this removing
Code: [Select]
if (fb != null) {
System.out.println("************************************ remove textures");
TextureManager tm = TextureManager.getInstance();
Set<String> names = tm.getNames();
if (names != null && !names.isEmpty()){
for (String name : names){
tm.removeAndUnload(name, fb);
}
}
fb.dispose();
fb = null;
}

first after recreate -  ERROR: A texture with the name 'redCell' has been declared twice! -  (in try{}catch)
and second, when try set - ERROR: Tried to set an undefined texture as default!
Title: Re: clear data
Post by: Alexey on August 08, 2011, 09:58:39 pm
sorry, i don read your last replay, i try create once
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 10:01:08 pm
You can actually do that for everything as long as you keep the references somewhere. There's no need to load objects and textures on each surface creation. The only thing that has to be recreated each time is the FrameBuffer because it takes the gl context and the orientation might have changed. But apart from that, jPCT-AE will take care to reuse your objects and textures in another context on another surface.
Title: Re: clear data
Post by: Alexey on August 08, 2011, 10:08:19 pm
in wallpaper service in oncreateEngine
Code: [Select]
texturesCreated = false;

 ...

if (!texturesCreated){
redCell = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.red_cell)), 64, 64));
blueCell = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.blue_cell)), 64, 64));
aNuc = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.nuc_a)), 64, 64));
tNuc = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.nuc_t)), 64, 64));
gNuc = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.nuc_g)), 64, 64));
cNuc = new Texture(BitmapHelper.rescale(BitmapHelper.convert(getResources().getDrawable(R.drawable.nuc_c)), 64, 64));
TextureManager.getInstance().addTexture("redCell", redCell);
TextureManager.getInstance().addTexture("blueCell", blueCell);
TextureManager.getInstance().addTexture("aNuc", aNuc);
TextureManager.getInstance().addTexture("tNuc", tNuc);
TextureManager.getInstance().addTexture("gNuc", gNuc);
TextureManager.getInstance().addTexture("cNuc", cNuc);
texturesCreated = true;
}
ERROR: Tried to set an undefined texture as default! - and because that i recreating rextures in onSurfaceCreated
Title: Re: clear data
Post by: EgonOlsen on August 08, 2011, 10:13:44 pm
I've no idea when you call onCreateEngine() or what you do when the app goes out of scope...but: If you upload the textures only once and never remove/unload/flush anything, then there is no need to reload them again. Just have a look at the examples that come with the engine: They don't do that! They load everything only once and keep it until the app gets destroyed by Android.
Title: Re: clear data
Post by: Alexey on August 08, 2011, 10:14:16 pm
sorry, i dont remove removing textures code, now 6 time without crash :) . Too late, i did not realize anything now, this wallpaper make me crazy :) I will continue tomorrow
Title: Re: clear data
Post by: Alexey on August 15, 2011, 09:46:49 am
I move all textures & world initialization to Engine.onCreate, in onDestroy clear world & textures, all work good, but, i worry that if on device installed 2 different applications and some textures has equals names?  TextureManager instance will be the same for both?
Title: Re: clear data
Post by: EgonOlsen on August 15, 2011, 10:33:14 am
No, it's only a singleton per VM instance.
Title: Re: clear data
Post by: Alexey on August 15, 2011, 11:29:21 am
Ok, thank you for replies!