Howto:Shader programming in FlightGear: Difference between revisions

Effects - shader section additions
No edit summary
(Effects - shader section additions)
Line 418: Line 418:
   <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
   <fragment-shader>Shaders/secondary_lights.frag</fragment-shader>
  </program>
  </program>
In the case of ALS Lights, so far we only have to deal with the fragment shader.


The program section of the effect file is a nifty method used to allow users to add shaders to [[Flightgear]] without having to add code at C level language base. The C level base is programed to recognize the XML tag pair of <program></program> and thus incorporate the GLSL program files pointed to between the tags. Otherwise you would have to add the GLSL program calls in the base C requiring a completely different set of programming skills and also the necessity of compiling [[Flightgear]] everytime you want to add new shaders.
We'll describe the contents of the shader programs below. For now, suffice it to say tree-ALS.frag contains the main program and secondary_lights.frag has functions that are passed uniform data that is manipulated and returned to main for processing.


==== Uniforms ====
==== Uniforms ====


=== Shader Program ===
=== Shader Program ===
330

edits