So I tried running the code but it gives list out of index range error. I changed the index from 1 to 0, but the screen only pops up black. How could I change the code to make it work?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You just have to pass the filename/path of the .obj file to the OBJ
class:
obj = OBJ('suzzane.obj')
Also, the script was written in Python 2 and if you want to use it with Python 3, you have to update a few things.
Change this line,
raise ValueError, "mtl file doesn't start with newmtl stmt"
to:
raise ValueError("mtl file doesn't start with newmtl stmt")
And all the map
iterators have to be turned into lists:
mtl[values[0]] = map(float, values[1:])
# Just call `list()`.
mtl[values[0]] = list(map(float, values[1:]))