Consistent triangulation when exporting shape keys I am attempting to export objects from blender into .obj format for use in an opengl program I am writing.  Currently, I am attempting to create shape keys in blender, then export them, then interpolate between them as my program runs.

Below is the python command that I use to export the .obj file.

bpy.ops.export_scene.obj(
    filepath = temp.name,
    use_selection = True,
    use_edges = False,
    use_normals = True,
    use_uvs = True,
    use_materials = False,
    use_triangles = True,
    keep_vertex_order = True)


Both the initial and final steps of the animation look as expected, with the shape key either applied entirely, or not applied at all.  However, in the interpolation between the two shape keys, there are graphical issues as shown below.




This seems to be caused by inconsistent triangulation between the two different shape keys, since the diagonal between the corners of the rectangles goes in the opposite direction at the two ends of the animation.  I would not have expected this, since I had passed the keep_vertex_order flag to the exporter.  Am I understanding the issue correctly, and is there a way to keep consistent triangulation?
You could add a Triangulate Modifier, with either Fixed or Fixed Alternate as the Quad Method. Make sure to Apply modifier in the .obj exporter with:

for obj in bpy.context.selected_objects:
    if not 'Triangulate' in obj.modifiers:
        tri_mod = obj.modifiers.new(name='Triangulate', type = 'TRIANGULATE')
        tri_mod.quad_method = 'FIXED'

bpy.ops.export_scene.obj(
    filepath = temp.name,
    use_selection = True,
    use_edges = False,
    use_normals = True,
    use_uvs = True,
    use_materials = False,
    use_triangles = True,
    keep_vertex_order = True
    use_mesh_modifiers = True)