6

テクスチャ ラッピングの問題に直面しています。これがアーティファクトを引き起こしています。私のコードベースが巨大になったので、私が考えることができる唯一の方法は、特定のテクスチャがアーティファクトを引き起こしているカテゴリに該当するかどうかを特定のチェックを実行し、レンダーバッファに描画する前にパラメータを変更することです.

では、概ね大丈夫でしょうか?のようなパラメータを設定するには

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

レンダリングループ中のglBindTextureの後?または、各レンダー フレーム中の操作が増加するため、FPS に影響しますか?

4

2 に答える 2

9

通常、テクスチャ パラメータを変更しても、キャッシュはそのまま残り、アクセス パターンのみが変更されるため、パフォーマンスに深刻な影響はありません。

ただし、この非常に特殊な使用シナリオのための OpenGL の以降のバージョンでは、「サンプラー オブジェクト」が導入されています。それらを見てみたいと思うかもしれません。

于 2012-07-30T13:02:17.173 に答える
3

The general rule of thumb is this: do not change any state you don't have to.

If a texture has an intrinsic property that makes you use a mirrored-repeat wrapping mode, then it should always have that property. Therefore, the texture should have been originally set with that wrapping mode.

If it's something that you need to do at render time, then yes, you can do it. Whether it affects your performance adversely depends entirely on how CPU bound your rendering code is.

Note:

Since my codebase has grown huge

This is never a good reason to do anything. If you can't figure out a way to make your code do this the right way, then something bad has probably happened within your codebase. And you should fix that before trying to deal with this texture issue.

于 2012-07-30T14:31:52.747 に答える