Time for action — adding a rock texture

We are going to use the same project and just create a new material:

  1. Create a new material called MyMaterial4, which is identical to the previous material:
    material MyMaterial4
    {
    technique
    {
    pass
    {
    texture_unit
    {
    texture terr_rock6.jpg
    }
    }
    }
    }
    
  2. Inside the texture unit block, add a line that tells Ogre 3D to use the clamp mode:
    tex_address_mode clamp
    
  3. Change the material we use for our quad from MyMaterial3 to MyMaterial4:
    manual->begin("MyMaterial4", RenderOperation::OT_TRIANGLE_LIST);
    
  4. Compile and run the application. You should see the stone texture from before in the upper-right corner of the quad. The other three parts of the quad should be lines of different colors.

What just happened?

We changed the texture ...

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.