def loadOBJ(filename):
    """
    Adapted from http://www.nandnor.net/?p=86
    See also http://paulbourke.net/dataformats/obj/
    """
    verts = []
    faces = []
    for line in open(filename, "r"):
        vals = line.split()
        if vals[0] == "v":
            v = map(float, vals[1:4])
            verts.append(v)
        if vals[0] == "f":
            # f = map(int, vals[1:4])
            f = []
            for v in vals[1:]:
                w = v.split("/")
                f.append(int(w[0]))
            faces.append(f)
    return verts, faces