pythonopengl3dpyopengl

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


How can I load an *.obj 3d model in Python and apply a texture to it? I managed to load, view 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 in Python?

I'm using PyOpenGL and I'm not allowed to use PyGame by my teacher.


Solution

  • you might want to check out ASSIMP, it has python bindings: https://github.com/assimp/assimp

    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