在OpenGL上映射Wavefront .obj纹理顶点 [英] Mapping Wavefront .obj texture vertex on OpenGL

查看:125
本文介绍了在OpenGL上映射Wavefront .obj纹理顶点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个艺术家为我提供了导出到.obj和.mtl的所有3D模型,以便可以使用OpenGL进行渲染.

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

但是我不知道为什么纹理顶点大于1有时是负数. 看一下这个例子:

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
(...)

他以TGA格式向我发送了所有纹理,我已正确加载了这些纹理,但无法将这些vt映射到正确的OpenGL纹理矢量.

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.

[0..1]范围之外的纹理坐标表示纹理重复.

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

给出一维纹理ABCD:

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

确保将GL_TEXTURE_WRAP_SGL_TEXTURE_WRAP_T设置为GL_REPEAT.

这篇关于在OpenGL上映射Wavefront .obj纹理顶点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆