How exactly does OpenGL do perspectively correct linear interpolation?
问题 If linear interpolation happens during the rasterization stage in the OpenGL pipeline, and the vertices have already been transformed to screen-space, where does the depth information used for perspectively correct interpolation come from? Can anybody give a detailed description of how OpenGL goes from screen-space primitives to fragments with correctly interpolated values? 回答1: The output of a vertex shader is a four component vector, vec4 gl_Position . From Section 13.6 Coordinate