I'm still working on getting procedural meshes right and I've hit another snag. It's a little hard to describe, so I'll show you a video first. The cube on the left is one I've created in code, the one on the right is an instance of TestCube for comparison.

https://www.youtube.com/watch?v=GnromJRwiZ4&feature=youtu.be

The flickering only occurs on two faces of the cube, the ones that are perpendicular to the Z axis. The other 4 faces render correctly. It only happens when the mesh includes normal data, whether I add the normals manually using SurfaceTool.add_normal() or if I automatically generate them with SurfaceTool.generate_normals() . If I omit normals entirely there is no flickering. Code listing follows.