Nuclide
Software Development Kit for id Tech
|
Shaders are referring to GPU-oriented pieces of a program, performing shading and rendering related functions instead of letting the engine handle it.
In FTEQW you can specify a custom GLSL or HLSL shader using the program command inside a Material.
This is a primitive shader file. It includes the vertex and fragment program.
It will respond to the diffusemap only, which is loaded into the d_f variable. It can be modified from that point onwards. The commented out line will turn all of the output red.
Give it a try, or something!
When we pass program <shadername>
in our Material, the engine will load glsl/<shadername>.glsl
to handle the material for us.
The shader in question needs to define a main
function for both a vertex and a fragment shader. That's what the **ifdef**s are for in the above example.
You can not have separate files handle vertex/fragment programs, unlike in id Tech 4/Doom III.
At some point in the main
function, we do have to set gl_Position
and gl_FragColor
respectively. Those can not be undefined.