How to load an *.obj file in python and apply a texture to it

Joost Verbraeken picture Joost Verbraeken · Jun 15, 2014 · Viewed 13.5k times · Source

The title is my question: How can I load an *.obj 3d model in Python and apply a texture to it. I managed to load a 3d model, view it and apply textures to simple blocks and walls, but it seems impossible to apply a texture to a 3d model. How can I do that? Is there a script to load a 3d model with a texture in Python.

I'm using PyOpenGL as platform and I'm not allowed to use pygame from my teacher.

Answer

user755921 picture user755921 · Jun 16, 2014

you might want to check out ASSIMP, it has python bindings: http://assimp.sourceforge.net

also, if you feel like writing your own .obj loader (it is a pretty simple format) check out this tutorial:

http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Load_OBJ