How are vertex shader outs sent as inputs to the fragment shader?

Posted by Jeffrey on Game Development See other posts from Game Development or by Jeffrey
Published on 2012-12-11T20:07:15Z Indexed on 2012/12/11 23:15 UTC
Read the original article Hit count: 221

Filed under:
|
|

I'm learning some OpenGL 3.2 way of doing things and I think it's quite great, I'm actually understanding more of shaders and non-fixed pipeline in 1 week rather than those 2 years I tried to learn OpenGL fixed pipeline functions. But here's my question:

From what I think I've understood the vertex shader is run for each vertexes in the VBO. But the fragments shader is run per each pixel (is that right?) which is a huge number compared to let's say 3 vertexes of a triangle.

Now it seems that in the vertex shader the out variables (like colors and stuff) are passed 1 to 1 to the fragment shader. But let's say that I pass to the fragment shader the position of the vertex in the vertex shader. How is all executed? What vertex (A, B or C of the hipothetical triangle) is passed per each fragment and why?

© Game Development or respective owner

Related posts about opengl

Related posts about shaders