Not able load md2 file with size 358 KB

Started by JKumar, September 15, 2010, 02:52:14 PM

Previous topic - Next topic

JKumar

Hi,

          I tried to load a md2 file with size 358 kb but its going out of memory.

Is there any max limit for the jPCT engine for rendering md2 files??

Can anyone provide any reference for loading and rendering a md2 file as i followed the same process of using Loader.loadMD2 but its going out of memory?

Please help

raft

you can try loading your model with desktop jPCT and serialize it.
new DeSerializer.serialize(..)

than load it in AE via
Loader.loadSerializedObject(..)

JKumar

HI,

        I serialized the model and it came around 1.9MB . The engine is not showing any memory exception but i am not able to see any rendering and its just a black screen

Following are my rendering logs:


09-15 03:53:21.985: INFO/jPCT-AE(2261): Adding Lightsource: 0
09-15 03:53:22.005: INFO/jPCT-AE(2261): OpenGL vendor:     Android
09-15 03:53:22.005: INFO/jPCT-AE(2261): OpenGL renderer:   Android PixelFlinger 1.0
09-15 03:53:22.005: INFO/jPCT-AE(2261): OpenGL version:    OpenGL ES-CM 1.0
09-15 03:53:22.005: INFO/jPCT-AE(2261): OpenGL renderer initialized (using 2 texture stages)
09-15 03:53:22.885: DEBUG/dalvikvm(2261): GC freed 17789 objects / 776040 bytes in 110ms
09-15 03:53:23.095: INFO/jPCT-AE(2261): Remapping 1618 vertex indices!
09-15 03:53:23.095: INFO/jPCT-AE(2261): Creating vertex cache (38832 bytes)!
09-15 03:53:23.105: INFO/jPCT-AE(2261): Vertex indices will be mapped!
09-15 03:53:23.105: INFO/jPCT-AE(2261): Subobject of object 0/rock compiled to indexed fixed point data using 7218 vertices in 849ms!
09-15 03:53:23.105: INFO/jPCT-AE(2261): Object 0/rock compiled to 1 subobjects in 1094ms!

raft

it can be because of ligthing and/or camera position and direction.
start with turning on ambient lighting to max value
World.setAmbientLight(255, 255, 255)
and try to place camera at a proper distance where it can see the whole scene. this depends on scaling of your model.

JKumar


JKumar

Hi,

     Another thing, As i have five animation in the model. I am not sure how to use animation methods:

1. model.animate(float)
2. model.animate(float, int)

Will they draw the frames or the animation sequences and how to utilize them.

raft

when you call animate(..) your object's mesh is updated according to given index. calculation is done via interpolating keyframes. that is every vertex of resulting mesh is an interpolation of corresponding two vertices in two keyframes.
for example if you have 3 keyframes for a sequence, and sequence number is 1:
Object3D.animate(0.25f, 1);
the resulting mesh will be interpolation of keyframe 0 and 1.
you should calculate index depending on your application and desired animation speed.

Object3D.animate(float, int)
this animates the model with given sequence number. (each 5 animation of your model is a separate sequence)

Object3D.animate(float)
this behaves like all sequences are merged into one

JKumar

Hi,

        All is going well and the credit goes to you.....I am able to render and use all the animations of the md2 file as guided.I have another request in queue and that is

How to use the collision detection in jPCT?

any reference would lead me in the next step of development



raft

very well. you are making quick progress. i guess you are not aware of there is a wiki for jPCT:
http://www.jpct.net/wiki/index.php/Collision_detection