Howto:Shader programming in FlightGear: Difference between revisions

m (add new category)
Line 83: Line 83:
So, shaders generally go around in pairs - one shader (the "Vertex shader") is a short program that takes in one vertex from the main CPU and produces one vertex that is passed on to the GPU rasterizer which uses the vertices to create triangles - which it then chops up into individual pixel-sized fragments.  
So, shaders generally go around in pairs - one shader (the "Vertex shader") is a short program that takes in one vertex from the main CPU and produces one vertex that is passed on to the GPU rasterizer which uses the vertices to create triangles - which it then chops up into individual pixel-sized fragments.  


A vertex shader is run once per vertex, while a fragment shader is run once per pixel.
A vertex shader is run once per vertex, while a fragment shader is run once per fragment covered by the primitive being rendered (a point, a line or a triangle). A fragment equate a pixel except in the case of multi-sampling where a pixel can be the weighted average of several fragments. Multi-sampling is used to remove aliasing and jagged edges.
Many such executions can happen in parallel. There is no communication or ordering between
Many such executions can happen in parallel. There is no communication or ordering between
executions. Vertex shaders are flexible and quick.
executions. Vertex shaders are flexible and quick.
269

edits