Problem with bulllet on symbian..

RapchikProgrammer
Posts: 8
Joined: Tue Feb 10, 2009 5:52 am

Problem with bulllet on symbian..

Post by RapchikProgrammer »

Hi all, i am developing a cross platform mobile game for symbian and iphone.. now i have created bvh triangle mesh and serialized it.. when deserializing my game runs perfect under windows.. but on symbian my application is crashing.. To make it clear for you i am using simple code for deserializing taken from a bullet demo app:
btTriangleIndexVertexArray* triArray = new btTriangleIndexVertexArray(indexCount/3,(int*)iindices,3*sizeof(int),vertexCount,(btScalar*)vvertices,3*sizeof(float));

btBvhTriangleMeshShape* trimeshShape = new btBvhTriangleMeshShape(triArray,true,false);

int size=0;

phyFile.Read(&size,sizeof(int));

int buffersize = size+btOptimizedBvh::getAlignmentSerializationPadding();

void* buffer = btAlignedAlloc(size,16);

phyFile.Read(buffer,size);

btOptimizedBvh* bvh = btOptimizedBvh::deSerializeInPlace(buffer,buffersize,false);

trimeshShape->setOptimizedBvh(bvh);
i have serialized the size of the buffer too here.. now i have noticed that under windows when i allocate the buffer, inside btAlignedAlloc the offset of the pointer is 4 bytes and it runs fine, but in symbian its 12 bytes and hence when i debug the function deSerializeInPlace the values in bvh are off by a fixed offset, like the value of minaabb.m_floats[3] should actually be the value of minaabb.m_floats[0] and the value of the next value maxaabb.m_floats[0] should actually be the value of minaabb.m_floats[1] .. i hope you get my point, and could help me out here..
RapchikProgrammer
Posts: 8
Joined: Tue Feb 10, 2009 5:52 am

Re: Problem with bulllet on symbian..

Post by RapchikProgrammer »

Found the problem, i was serializing the meshes on windows with a 4 byte offset and reading with a 12 byte offset.. i serialized the meshes again on my phone, and read from there and it works perfectly..