I have a 3-D object I created in blender. I would like to export it from blender and be able to import it into OpenGL. Is there a method or specific file extension recommended for this process?
Asked
Active
Viewed 9,109 times
1 Answers
4
From Here:
Use obj files. Simple text files that describe a 3d model. Then in opengl load the data into vertex arrays, and display using openGL. There is also window management to take care of.
Try python SDL and/or pygame to get you started.
Here is a link to jump start you:

White Shadow
- 444
- 2
- 10
- 26

beiller
- 3,105
- 1
- 11
- 19
-
Thank you very much! I exported my object to a obj file and ran the code with the pygame example. For anyone else reading this, be sure to keep the mtl and obj files together. – wholesomechoice Jul 02 '13 at 19:00
-
Good to hear. From what I understand the mtl file is optional, it gives the material details. Maybe this script requires it however. Regards! – beiller Jul 02 '13 at 20:09
-
Do you know how to load also vertex colors? – Noam Peled Apr 23 '17 at 03:32
-
It looks like OBJ file format doesn't support vertex colors. However, there is PLY format apparently: https://gamedev.stackexchange.com/questions/21303/how-can-i-include-vertex-color-information-in-obj-files – beiller Apr 24 '17 at 14:04
-
I tried it using ply file, but it doesn't look work out. Do you know why? It says that line 14 raise ValueError, "mtl file doesn't start with newmtl stmt". Could you tell me why? Thank you! – python3 Jun 08 '17 at 05:25
-
Make sure that your object has at least one material, and that it has UV coordinates. Then try it again. – beiller Jun 12 '17 at 20:41
-
I haven't tried this answer yet, although it looks promising. Thank you. Note however that the first link is broken. – N. Boumakis Jun 18 '21 at 14:35