本文介绍了在渲染期间设置glTexParameteri()是否不好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临纹理包裹的问题.这导致了伪像.由于我的代码库已经变得越来越庞大,所以我想到的唯一方法是执行某些检查,以查看某些纹理是否属于引起伪像的类别,并在绘制到渲染缓冲区之前更改参数.

I am facing issues with texture wrapping. which is causing artifacts. Since my codebase has grown huge the only way that I can think of is to perform certain checks to see if certain textures fall under the category which are causing artifacts and change the parameters before drawing onto the renderbuffer.

所以通常可以吗?设置类似

So is it generally ok? to set parameters like

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);

在渲染循环期间在glBindTexture之后

?还是会影响FPS,因为它将增加每个渲染帧期间的操作?

after glBindTexture during render loop? or would it effect FPS as it would increase operations during each render frame?

推荐答案

更改纹理参数通常不会对性能产生太大的影响,因为它会使高速缓存保持不变,并且只会更改访问模式.

Changing texture parameters usually doesn't have a too serious impact on performance, as it leaves caches intact and only changes the access pattern.

但是,在此更高版本的OpenGL更高版本中,引入了采样器对象".我想您可能想看看它们.

However in later versions of OpenGL for this very specific usage scenario "Sampler Objects" have been introduced. I think you might want to have a look at them.

这篇关于在渲染期间设置glTexParameteri()是否不好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 23:33