For example, taking from RBGUI, we have some definitions:
Code: Select all
uniform sampler2D image;
void main( )
{
gl_FragColor = texture2D( image, gl_TexCoord[0].st ) * gl_Color;
}
Code: Select all
// Pixel shader used for rendering Gui elements, GLSL
fragment_program GuiPixelShaderGLSL glsl
{
source GuiPixel.glsl
default_params
{
param_named image int 0
}
}
Code: Select all
// Material for Gui rendering
material GuiMaterial
{
technique
{
pass
{
cull_hardware none
cull_software none
depth_check off
depth_write off
lighting off
vertex_program_ref GuiVertexShader
{
// ...
}
fragment_program_ref GuiPixelShader
{
// ...
}
texture_unit Image
{
tex_address_mode clamp
filtering linear linear none
}
}
}
}
1. What are default_params, I thought programs requiring input parameters need to have parameters passed in? Maybe they aren't related?
2. param_named image int 0, the main function above uses a variable image, but it looks like the variable is defaulted to 0? Totally confused here, what data type is image and what is the following line trying to accomplish?
Code: Select all
gl_FragColor = texture2D( image, gl_TexCoord[0].st ) * gl_Color;Code: Select all
vertex_program_ref GuiVertexShader
{
// ...
}
I know this might seem basic shader knowledge, and part of it is, but I also lack understanding of how shaders are used in the Ogre pipeline, I don't understand how Ogre uses them and how we can configure them. (Referring me to CG tutorials won't help me much, I need to be able to use these in Ogre)


