A very basic triangulation and index problem in my export import script

Am writing export/import script for mesh objects for our game engine. To start with, am not re-inventing the wheel, as we are working on mobile game, we want the size to be very compact. The complete setup was ready in couple of ours. We are able to export/import objects from blender and import mesh into our game engine.

Problem: I triangulate the mesh before exporting. When I re-import the same mesh, the triangles on the same quads are not correctly indexed.

I’ve attached the screenshot for quick explanation (A cube is exported and imported again within blender). and script for debugging.

My guess: As I’ve the same problem in blender import script and our game engine import, I guess the problem is, am wrong in exporting the index.

sgm.zip (2.83 KB)

I fixed this issue before my post got approved in this forum.

FIX: Now, I am not triangulating the mesh but just creating 2 triangle info from each quad, and it works just fine.