Skip to main content
GameDev.net gamedev.net
🔒 Locked

Large texture coordinate range

Started by Gribbles Feb 23, 2013 at 3:46 AM 0 replies 1k views
Original Post
Gribbles
Gribbles

So I'm working on converting files model files to my own format and I noticed that the texture coordinates range from -5 to 1.8. If I am understanding how textures are supposed to work, The coordinates are supposed to range from 0-1 and anything other than that is covered by the WRAP variable in the sampleState.

Is this correct? Do I need to do something else to handle the case of such a wide range of tex coords? because it doesnt show up right in my program, but other models do and it shows up fine in maya and blender.

Thank You

_paf
_paf

If the model has been created and textured mapped correctly, then those coordinates mean that the texture repeats when mapped to the model.

In order to make it show correctly on your program, when you load the texture the model uses, you have to set the wrap mode to repeat instead of clamp.

For example, in OpenGL you'd do this:


glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

You can also try GL_MIRRORED_REPEAT instead of GL_REPEAT if it doesn't appear correct.

See if it works.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.