Skip to main content

History: Orange Shader

Source of version: 4 (current)

Copy to clipboard
            {maketoc}

!!Description
This is the first and easiest shader. It is not very useful, except for a tutorial purpose. It will just paint your object in a predefined color (here: orange).
{img src="img/wiki_up/Orange_shader.jpg" alt="Orange_shader.jpg"}

!!Usage
Just give the material __shader/orange__ to your object.

!!orangeshader.cg
{CODE(wrap="1", colors="c++")} // -----------------------------------------------------------
 // Very simple shader
 // The object is colored in orange
 // -----------------------------------------------------------
 
 float4 main_fp(in float3 TexelPos : TEXCOORD0) : COLOR
 {
     float4 oColor;
 
     oColor.r = 1.0;
     oColor.g = 0.8;
     oColor.b = 0.0;
     oColor.a = 0.0;
 
     return oColor;
 }
{CODE}
!!orangeshader.material


Note: See [http://www.ogre3d.org/docs/manual/manual_18.html] for a list of profiles

{CODE(wrap="1", colors="c++")} fragment_program shader/orangeFP cg
 {
     source orangeshader.cg
     entry_point main_fp
     profiles ps_1_1 arbfp1
 }

 material shader/orange
 {
     technique
     {
         pass
         {
             fragment_program_ref shader/orangeFP
             {
             }
             texture_unit
             {
             }
         }
     }
 }
{CODE}

---
Alias: (alias(Orange_Shader))