Time for action — using colors to see interpolation

To see how color interpolation works we need to change our code a bit.

  1. Again, copy the material and make sure to adjust all names.
  2. The only thing we need to change in the material is that we don't need a texture unit. We can just delete it.
  3. In the application code, we need to replace the textureCoord() with color():
    manual->position(5.0, 0.0, 0.0);
    manual->color(0,0,1);
    manual->position(-5.0, 10.0, 0.0);
    manual->color(0,1,0);
    manual->position(-5.0, 0.0, 0.0);
    manual->color(0,1,0);
    manual->position(5.0, 10.0, 0.0);
    manual->color(0,0,1);
    
  4. The vertex shader also needs some adjustments. Replace the two texture coordinate parameters with color parameters and also change the assignment line:
    void MyVertexShader4( ...

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.