glsl & perspective correction of varying values

后端 未结 1 1121
暗喜
暗喜 2021-01-27 00:47

is every varying vertex value (or in newer versions of glsl values that go \"out\" of a vertex shader) interpolated by the rasterizer using perspective correction? is this hardw

相关标签:
1条回答
  • Pre-GL 3.0, the only way to affect perspective-correct interpolation is with a hint. Generally, glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) will activate perspective-correct interpolation on all varyings, while glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST) will generally turn it off. Note that these are driver hints and nothing more; drivers don't have to react this way.

    In GLSL 1.30+ (OpenGL 3.0+), you have the ability to force each output/input to interpolate in a specific way. The interpolation qualifier smooth means perspective-correct; this is the default if you don't specify a qualifier. noperspective means... the obvious.

    Clipping is always done in such a way that it will work exactly as if it weren't clipped (or near enough within hardware precision). So if a value is interpolated perspective-correctly, then the value generated for the clipped vertex must also use perspective-correct interpolation.

    0 讨论(0)
提交回复
热议问题