Jump to: navigation, search

Howto:Shader programming in FlightGear

412 bytes added, 18:34, 26 March 2010
What is a Shader
To make it simple, a shader is a program that is loaded on the GPU and called for every vertex or pixel: this gives programmers the possibility to implement techniques and visual effects and execute them faster. In modern games or simulators lots of shaders are used: lights, water, skinning, reflections and much more.
Shaders will be compiled when the 3D application starts. They will be validated and optimized for the current hardware. We can create as many shader programs as needed(you can have many shaders of the same type (vertex or fragment) attached to the same program, but only one of them can define the main() function). Each Shader program is assigned an handler, and you can have as many programs linked and ready to use as you want (and your hardware allows). Once rendering, we can switch from program to program, and even go back to fixed functionality during a single frame.
To really understand shaders, you should have a knowledge about the rendering pipeline; this helps to understand where and when the shaders act in the rendering process. In general, you must know that vertex are collected, processed by vertex shaders, primitives are built, then are applied colors, textures and are also called fragment shaders; finally it comes to the rasterization and the frame is put on the buffer.

Navigation menu