Time for action — modifying the texture

We will use a fragment shader to modify the texture, so change the material to also make use of a fragment shader. Also copy the material and the compositor. This compositor should have the name Compositor2, the material Ogre3DBeginnersGuide/Comp2.

  1. fragment_program_ref MyFragmentShader5
    {
    }
    
  2. Don't forget to define the fragment program in the material file before using the reference:
    fragment_program MyFragmentShader5 cg
    {
    source Ogre3DBeginnersGuideShaders.cg
    entry_point MyFragmentShader5
    profiles ps_1_1 arbfp1
    }
    
  3. Also create a new fragment shader in our shader file. This shader has, as input, the texture coordinates and a texture sample. Once the color of the fragment is computed, this color is returned:
    void ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.