简体   繁体   English

在OpenGL上映射Wavefront .obj纹理顶点

[英]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. 一位艺术家为我提供了导出到.obj和.mtl的所有3D模型,以便可以使用OpenGL进行渲染。

But I can't figure out why the texture vertex are greater than 1 and sometimes negative. 但是我无法弄清楚为什么纹理顶点大于1且有时为负。 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. 他将TGA格式的所有纹理发送给了我,我已经正确加载了它,但是我无法将这些vt映射到正确的OpenGL纹理矢量。

But I can't figure out why the texture vertex are greater than 1 and sometimes negative. 但是我无法弄清楚为什么纹理顶点大于1且有时为负。

Texture coordinates outside the [0..1] range indicate texture repetition. [0..1]范围之外的纹理坐标表示纹理重复。

Given a 1D texture ABCD : 给定一维纹理ABCD

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

Make sure GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T are set to GL_REPEAT . 确保GL_TEXTURE_WRAP_SGL_TEXTURE_WRAP_T设置为GL_REPEAT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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