简体   繁体   中英

Mapping Wavefront .obj texture vertex on OpenGL

An artist gave me all 3D models for me exporting to .obj and .mtl in order that I can render it using OpenGL.

But I can't figure out why the texture vertex are greater than 1 and sometimes negative. Take a look at this example:

(...)
vn -0.000717425 0.00106739 -0.00991695
vn 3.49779e-09 -5.22866e-09 -0.01
vn -0.00142294 0.00211706 -0.00966919
vn -0.00831486 -0.00555545 0
vt 5.82424 -20.091
vt 6.97527 -20.1873
vt 5.81848 -20.1618
vt -7.48189 8.29159
(...)

He sent me all textures on TGA format, which I am loading it correctly, but I am not being able to map these vt s to a correct OpenGL texture vector.

But I can't figure out why the texture vertex are greater than 1 and sometimes negative.

Texture coordinates outside the [0..1] range indicate texture repetition.

Given a 1D texture ABCD :

   -1    0    1    2
....|ABCD|ABCD|ABCD|....

Make sure GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T are set to GL_REPEAT .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM