Howto:Shader programming in FlightGear: Difference between revisions

Jump to navigation Jump to search
m
Line 19: Line 19:


= What is a Shader =
= What is a Shader =
A shader is a programmable replacement for parts of the fixed function OpenGL pipeline, you can imagine it sort of like a "plugin" to customize rendering.
A shader is a programmable replacement for parts of the fixed OpenGL function pipeline, you can imagine it sort of like a "plugin" to customize rendering for specific scene elements.
 
GLSL shaders are not stand-alone applications; they require an application that utilizes the OpenGL API.
A shader is a program, to be run it must be loaded, compiled and linked.  
Shaders will be compiled when the 3D application starts. They will be validated and optimized for the current hardware.
Shaders will be compiled when the 3D application starts. They will be validated and optimized for the current hardware.


GLSL shaders are not stand-alone applications; they require an application that utilizes the OpenGL API.
Actually each vertex and fragment shader must have one entry point (the main function) each, but you can create and link more shaders.
A shader is a program, to be run it must be loaded, compiled and linked. Actually each vertex and fragment shader must have one entry point (the main function) each, but you can create and link more shaders.


GLSL shaders themselves are simply a set of strings that are passed to the hardware vendor’s driver for compilation from within an application using the OpenGL API’s entry points. Shaders can be created on the fly from within an application or read in as text files, but must be sent to the driver in the form of a string.  
GLSL shaders themselves are simply a set of strings that are passed to the hardware vendor’s driver for compilation from within an application using the OpenGL API's entry points. Shaders can be created on the fly from within an application or read in as text files, but must be sent to the driver in the form of a string.  


GLSL has explicit ties to the OpenGL API - to the extent that much of the OpenGL 'state' (eg which light sources are bound, what material properties are currently set up) is presented as pre-defined global variables in GLSL.
GLSL has explicit ties to the OpenGL API - to the extent that much of the OpenGL 'state' (eg which light sources are bound, what material properties are currently set up) is presented as pre-defined global variables in GLSL.
2,561

edits

Navigation menu