Mapping Wavefront .obj texture vertex on OpenGL

给你一囗甜甜゛ 提交于 2019-12-22 06:56:01

问题


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 vts to a correct OpenGL texture vector.


回答1:


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.



来源:https://stackoverflow.com/questions/22465212/mapping-wavefront-obj-texture-vertex-on-opengl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!