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.


Messages - kiffa

Pages: 1 ... 8 9 [10] 11 12 ... 14
136
Should i unload the texture which will be replaced?

Code: [Select]
new texture1;
tm.addTexture("dog", texture1);
dog.setTexture("dog");

new texture2;

//Then
tm.unloadTexture("dog");
tm.replace("dog", texture2);

//Or just need
tm.replace("dog", texture2);  // the new texture wiil be auto upload to gpu, and the old one will be auto unloaded




137
I have a dog, in scene-1, the dog will be set to texture1 which named "dog".

In scene-2,  i first removeAndUnload("dog"), then new texture2 which is different from texture1 but has the same name "dog", then set the texture2 to the dog.

But the dog in scene-2 looks like with another texture which is not texture2.

Codes:

Code: [Select]
//scene1
texture1 = new texture(in);
textManager.addTexture("dog", texture1);
dog.setTexture("dog");

//do something
...

//switch to scene2
removeAndUnload("dog");

//in scene2
//add some other texture first
textureManager.addTexture("some other textures")

//new texture2 with the same name "dog"
texture2 = new texture(in2);
textureManager.addTexture("dog", texture2);

dog.setTexture("dog");

// the dog seems not to be set to  the texture2, but one of "some other textures"

I guess that was caused by some caching mechanism?











138
Support / Re: How does the Virtualizer work?
« on: September 06, 2012, 04:28:38 am »
I got it, thanks!

And could you explain the memory usage when Framebuffer.blit()?

new texture -> Framebuffer.blit() -> Then what happend? Upload the blited texture to gpu? And when free it?

139
Support / Re: How does the Virtualizer work?
« on: September 05, 2012, 10:43:47 am »
And you say:

Code: [Select]
obj=null;
obj=new Object();

insted of

Code: [Select]
obj=new Object();
I am a new  Javaer, could you explain more? Does the previous code make the GC happier(So, the memory of the obj will be freed fastter)?

140
Support / Re: How does the Virtualizer work?
« on: September 05, 2012, 10:32:18 am »
Sorry, there are 3 512X512 jpg in the largest scene, not 2.

And the memory map is roughly like this:
1, Damn android-system-res - 4M+

2, dog.bones(a model of 6000+ trangles with 2000 frames animations)  -  5M+

3, textures of models, about 512*512*4*3 + 512*512*2*3(gpu) = 4.5M(Do i calculate correct?)

4, some 2D textures, used for Framebuffer.blit(), and i don't know how does the memory use and free in this stage.

5, some images(some are large - 800X480) used for the Dialog class of android sdk (to implements the full-screen-menu), my friend do this, so i don't know the details clearly.

6, some .ser models - 6000 trangles at most.

7, other data structures with a little memory usage.

And i have reduced the textures to 2 512*512 plus 1 256*256,  the dog-animation to 1500+ frames, this help much.

But i really want to free the android-sys-res....

141
Support / How does the Virtualizer work?
« on: September 04, 2012, 07:16:06 am »
I want to use the Virtualizer class of jPCT-AE to resolve OOM, and i have read the doc, but i want to know a little more, thanks.

The process of my app is like this:

Load all models(.ser and .bones) ->
entry Scene1 -> Load all textures which are used in scene1 only -> some logic\event\draw ->
switch to Scene2 -> removeAndUnload all textures(Config.unloadImmediately = true) ->
entry Scene2 -> Load all textures which are used in scene2 only -> repeat like scene1 ... ...
-> switch to SceneN ... ...

And the OOM usually happened in the stage of "entry new scene -> load textures", my question:

1, Does the process of loading texture need more memory(peak) than the texture itself? For example:  new Texture("1024X1024.jpg"), the texture will consume 1024x1024x4 bytes of memory finally, but does the process of "new Texture(like io、decode-jpg and so on)" need more memory than 4MB?     

2, Does TextureManager.removeAndUnload () guarantee freeing memory immediately ?

3, Does the follow memory-route right?

new Texture(1024X1024) -> 4MB

set Virtualizer -> set context -> virtualize the texture -> swap the texture from vm to disk(flash) -> 0MB

Frambuffer.draw() -> upload the texture to GPU -> I don't know what happen with the virtualized-texture in this stage, help please.

removeAndUnload the virtualized-texture -> what happened?

Does the virtualized-texture need be swapped back(from disk to vm) in any situation? When? Does the process of virtualizing need more memory(peak) than the texture itself? How much time does the process of virtualizing consume typically?

4, Seems there are enough memory in every scene of my app(all of them can run fine alone),  but OOM happened in the scene switching, any suggestions? Many thanks! I have reduced my texture to two jpg(512X512) per scene, and it's hard to reduce more. And i also enabled Texture.4bpp, disabled Texture.Mipmapping.

142
Support / Re: How to set the transparency of texture?
« on: August 27, 2012, 04:18:30 pm »
Now it's ok! Thanks!

143
Support / How does the (Object3D)parent affect the children?
« on: August 27, 2012, 04:17:46 pm »
My codes:

Code: [Select]
   
    Object3D mDog = xxxxxx; //Loader init
    Object3D obj =  Object3D.createDummyObj();
    obj.addChild(mDog);
    obj.addChild(otherObjs);
    obj.rotateY(1);

   if(mDog.getRotationMatrix().isIdentity()){
      log.d("xx", "true");
  };

   if(mDog.getTranslationMatrix().isIdentity()){
      log.d("xx", "true2");
  };


The result is "true"、"true2".

I want to reset "mDog" to its original position after "obj.rotateY(1)",  and the code "mDog.clearRotation()" is useless. Doesn't the rotation of the parent-Object3D affect the RotationMatrix of children-Object3D?

144
Support / How to set the transparency of texture?
« on: August 27, 2012, 09:35:16 am »
I used a PNG file with alpha channel as the texture of an Objcet3D, and some fragment of the Object3D were mapped to full-transparency pixel of the texture.

But when i run the app, the fragment which should be full-transparency were filled with black color.

How do i set the transparency of texture? My codes:

Code: [Select]
      in = res.openRawResource(R.raw.tex_world_trees);
      Texture t = new Texture(in, true);  // with alpha
      tm.addTexture("world_trees", t);
      in.close();
     
     obj.setTexture("world_trees");

    world.addObject(obj);
    //render、draw、display...
   

145
News / Re: A book on mobile game engines...
« on: August 13, 2012, 08:42:19 am »
I will read it. But seems i can't access this address.(http://mobilegameengines.com/interviews_with_mobile_game_engine_developers)

I don't know whether the server can't be access now or it is blocked by China_Greate_Fire_Wall.

146
Support / Re: How to estimate the memory-usage in jPCT-AE?
« on: August 13, 2012, 08:36:35 am »
What exactly do you mean? That creating an empty Activity already consumes 4mb of VM memory?

Yes, and the 4mb of memory was consumed by androd-system-preloaded-res. 



147
Bones / Re: Could i load the skin-animations separately?
« on: August 13, 2012, 08:10:29 am »
Yes, there is only one copy of mesh in memory, but i need to load the same mesh twice, which means more "waiting time" for users.

But i think this is not a serious problem, i can handle this by someway, thanks!

148
Bones / Re: Could i load the skin-animations separately?
« on: August 11, 2012, 06:11:05 am »
Do you mean that:

1, export "dog-mesh + dog-skin-animation(1-1000frames)" as dog1.bones

2, export "dog-mesh + dog-skin-animation(1001 - 2000frames)" as dog2.bones

In this way,  the dog-mesh will be loaded twice, but it only need be loaded once.

Could i load the mesh.xml once and load the skeleton.xml separately?

149
Bones / Could i load the skin-animations separately?
« on: August 10, 2012, 08:38:59 am »
I have an animated-dog, it has many skin-animation-frames(about 2000+, sampled by 24frame/s).

If i load all of them in one time, the left memory will be not enough. So, i want to load 1 - 1000 frames in scene1, and when the world switch to scene2, i will release 1-1000 frames, and load 1000-2000 frames.

How could i do this?

150
Thanks all!

I have used ".ser + .bones" instead of "all as .bones", the memory usage has a 3M-decrease, it's good enough for me. And as raft say, i added the Object3D as the children of Animated3D, they worked well!

Pages: 1 ... 8 9 [10] 11 12 ... 14