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.
    Time for action — adding a rock texture

What just happened?

We changed the texture mode to clamp. This mode uses the border pixels of a texture to fill all texture coordinates that are greater than 1. In practice, this means the border of an image gets stretched over the model; we can see this effect in the preceding image.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.128.120