You can improve the performance by moving calculations out of the innermost loop. You’ve also calculated the inverse of the transform, but the only reason you need to do that is because you’re multiplying on the wrong side of the vector (to transform X by matrix Y, you would calculate Y * X).

```
import bge
WireframeColor = [1,0,0]
own = bge.logic.getCurrentController().owner
mesh = own.meshes[0]
transform = own.worldTransform
draw_line = bge.render.drawLine
meshes = own.meshes
get_vertex = mesh.getVertex
for i in range(mesh.numPolygons):
poly = mesh.getPolygon(i)
for i in range(1, poly.getNumVertex()):
vertIndex1 = poly.getVertexIndex(i)
vertIndex2 = poly.getVertexIndex(i - 1)
vert1 = get_vertex(0, vertIndex1)
vert2 = get_vertex(0, vertIndex2)
vertpos1 = transform * vert1.XYZ
vertpos2 = transform * vert2.XYZ
draw_line(vertpos1, vertpos2, WireframeColor)
own.visible = False
```

You’re correct in saying this is slow - openGL draw calls with the Python wrapper seem to be slow,