Textures and exporting to wavefront obj files.

I am not an artist. I make programmer art and thus have never used blender before.

I am trying to export a blender model into a wavefront .obj in order to load it into OpenGL code (using C).

From what I can tell of the .obj documentation and export_obj.py I should be able to export textures with the obj files, including texture coordinates etc. However, when I export I seem to get materials only and no image textures (this is not anything to do with my code, the .obj and .mtl files are exactly the same exporting before and after adding the texture). The rendering inside blender works fine and displays the texture on the object.

In blender I have just done the following from the blender “noob to pro” tutorials:
delete the starting cube
add a suzanne monkey
add a brown material to the monkey
add a texture (type image) to the material from a .tga file (not sure if it has to be a different file type but this at least shows up inside the blender render)
render to test
export to wavefront .obj with default options + normals + copy images

I am using Blender 2.45 (from the Debian Testing repository)

Is it definitely possible to save the textures with the obj and mtl files (including texture coordinates etc)? If so, what am I missing?

ghell,

Welcome to the forums!

I believe that in order for the image to be taken with the object, it must be uv mapped, not an image texture. Have a look at the following for info on UV mapping a texture.

http://wiki.blender.org/index.php/Manual/UV_Unwrapping_And_Texturing
http://wiki.blender.org/index.php/Manual/Unwrapping_a_Mesh
http://wiki.blender.org/index.php/Manual/Editing_the_UV_Layout
http://wiki.blender.org/index.php/Manual/Using_UV_Textures

Best of Luck!

Did you find the solution to this? I have the same problem.
I created a model with blender. This model has material and texture. I export the model to wavefront (obj and mat), and then use
glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL | GLM_TEXTURE);
in my code to draw the model. I get the following warning:
glmDraw() warning: texture render mode requested with no texture coordinates defined.
I’m not sure if I’m not exporting correctly, or if it’s something else.

– ramon