I’m not sure. Does fragment shader run one time for every triangle or every vertex?
Following the pipline, it’s after Primitive Assembly. but if it’s for a triangle, why does it only have one gl_FragColor. One triangle don’t have to have only one color.
I’m not sure. Does fragment shader run one time for every triangle or every vertex?
Neither. It is run for every fragment. A triangle is rasterized into a number of fragments, based on the area that the triangle covers. Large triangles will generate more fragments than small triangles.
No, a fragment is not a pixel. Pixels are stored in images, like the framebuffer. A fragment is a collection of information that may be written to one or more samples in the framebuffer.
The area a fragment covers is no larger than the area of a pixel. If antialiasing is in use, it may be smaller than the area of a single pixel.
Fragments become pixels, but they are not pixels yet.