2

有点难看,但看起来那两张脸之间有黑白点。我怀疑这是 OpenGL 的质量设置之一,但我不知道是哪个。或者是纹理最小/放大过滤器(我将它们都设置为线性)?还是我需要 mipmapping 来解决这个问题?不太确定我应该寻找什么。


想出了如何做 mimapping....但这似乎使问题变得更糟。

这是我的一些设置(它在 C# 中,但它只是 C API 的一个薄包装器)

VSync = VSyncMode.On;

GL.Enable(EnableCap.DepthTest);
GL.DepthFunc(DepthFunction.Less);

GL.Enable(EnableCap.CullFace);
GL.CullFace(CullFaceMode.Back);
GL.FrontFace(FrontFaceDirection.Ccw);

GL.ClearColor(Color.MidnightBlue);
GL.Enable(EnableCap.Texture2D);

GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);


texture = new Texture(TextureTarget.Texture2D);
texture.LoadImage2D("checkers.jpg");

GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);

Texture.SetParameter(TextureTarget.Texture2D, TextureMinFilter.LinearMipmapLinear);
Texture.SetParameter(TextureTarget.Texture2D, TextureMagFilter.Linear);
Texture.SetParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, TextureWrapMode.ClampToEdge);
Texture.SetParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, TextureWrapMode.ClampToEdge);

Texture.SelectActive(TextureUnit.Texture0);

我无法注意到其他纹理:

所以也许我不会担心它......我们去照明吧!

4

1 回答 1

3

You probably need to set the texture wrapping:

glTexParameterf (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

If it's currently set to repeat, you'll get the artifacts you're seeing.

于 2012-01-03T02:31:46.337 回答