简体   繁体   English

OpenGL Skybox问题

[英]OpenGL Skybox Issue

There are seems on the edges of the cube that I have constructed and I cant understand why. 我所构造的多维数据集的边缘似乎有一些,我不明白为什么。 I have set the following parameters... 我设置了以下参数...

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);   
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

The lines only appear sometimes, it depends on what angle the camera is sitting at. 线条有时仅出现,这取决于相机所坐的角度。 Any ideas why the lines are still there? 任何想法为什么线仍然存在?

It would help if you could show us a screen shot. 如果您可以向我们显示一个屏幕截图,将会有所帮助。 But the problem is probably the fact that you're not interpolating the textels along the edge of each face with their neighbors on the other faces. 但是问题可能出在以下事实:您没有在每张脸的边缘上插入文本框,而在另一面上却没有插入它们的邻居。

So you should add a border to each texture by copying the edges of the neighboring textures, and change the filter mode to GL_CLAMP . 因此,您应该通过复制相邻纹理的边缘为每个纹理添加边框,并将滤镜模式更改为GL_CLAMP Or you can use a cubemap texture instead. 或者,您可以改用立方体贴图纹理。

maybe you need to add: 也许您需要添加:

glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

in the code you provided there is only S and T coord setup, you need the R as well. 在您提供的代码中,只有ST坐标设置,您也需要R。

Turns out this was actually a problem with SOIL which is the texture loading program that I was using. 原来,这实际上是SOIL的问题,而SOIL是我使用的纹理加载程序。 After I changed the texture loading method the lines dissapeared 更改纹理加载方法后,线条消失了

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

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