I made a draw call optimizer , that work by optimizing small (nearby) meshes into a merged optimized mesh. This all work perfectly fine for optimizing 2 meshes , but now i want to call the same optimizer to add 2 (already) optimized meshes into a new optimized mesh, and here the AppGameKit bug is:
//simple test code
orgobj = load your object that include position,normal,uv
mergemesh = CreateMemblockFromObjectMesh(orgobj,1)
CreateFileFromMemblock("run1.memmesh",mergemesh)
nobj = CreateObjectFromMeshMemblock(mergemesh)
DeleteMemblock(mergemesh)
mergemesh = CreateMemblockFromObjectMesh(nobj,1)
CreateFileFromMemblock("run2.memmesh",mergemesh)
DeleteMemblock(mergemesh)
In the glVertexAttribPointer setup in the mesh memblock, the string part length include padding in AGK.
The problem is when you process a second time, AppGameKit add another 4 byte padding so str len get 4 bytes larger. and attribytes is moved out of place.
At this point the object will not work and AppGameKit will crash if you process these objects.
I tried to correct the headers, but if i set the correct str len. then the object will not display in AppGameKit, so im kind of stuck here.
I have some GameGuru Loader customers that have made large games with many smaller objects, AppGameKit dont like many smaller objects and the fps gets lower and lower due to the many GPU stage changes going on, the drawcall optimizer give a nice fps boost, but i like to run a second pass to get a even better FPS, So i beg on my knee's for a quick fix
Test level screenshot: Same colors include 2 small objects merged into a optimized mesh: