View Full Version : 3DS Texture Coordinates

A Smith
05-25-2010, 07:21 PM
I have written a model loader for .obj models that reads in all the texture coordinates and normals etc... and am having trouble getting the texcoords to map to the texture correctly.

The original model was in 3DS format and I used blender to convert it to .obj, however, I noticed that all the texture coordinates are like this:

vt 0.1234 1.9876
vt 0.0258 1.1253

The first float is always between 0 and 1
The second float is always between 1 and 2
I am then using glTexCord2f(...) to specify the coords (I have bound the texture already) before each normal and vertex.

Now when running this, it is drawn correctly apart from the texture. The texture doesn't even seem to be mapping onto the model but when I alter the actual texture picture (.jpg) the changes then show on the model.

I've tried rotating & reflecting the texture file but no matter what I do it never seems to map.

Using another .obj file with vts like:

vt 0.1345 0.1234
vt 0.9987 0.0257
(where both the numbers are between 0 and 1)

the model then displays correctly with the texture perfectly on it.

So my question is; Are the texture coordinates between 1 and 2 valid texture coordinates? (vt 0.1235 1.9512)

Note: I've got a 3DS model loader online that I found, and when mapping those texture coordinates I also have the exact same problem.

05-26-2010, 02:33 AM
Yes, there are and how they are interpreted is up to the application. This is what the OpenGL texture wrapping mode is used for.

In most of the cases when your model comes from a modeler application like 3DS or blender, then you should use GL_REPEAT for the texture wrapping mode as this is what the modelers assume by default.