Time for action — preparing to scroll a texture

This time, we are going to change our quad to see the effect of the new material:

  1. Change the used material to MyMaterial8 and also change the texture coordinates from 2 to 0.2:
    manual->begin("MyMaterial8", RenderOperation::OT_TRIANGLE_LIST);
    manual->position(5.0, 0.0, 0.0);
    manual->textureCoord(0.0,0.2);
    manual->position(-5.0, 10.0, 0.0);
    manual->textureCoord(0.2,0.0);
    manual->position(-5.0, 0.0, 0.0);
    manual->textureCoord(0.2,0.2);
    manual->position(5.0, 10.0, 0.0);
    manual->textureCoord(0.0,0.0);
    
  2. Now create the new material MyMaterial8 in the material file. This time, we don't need any texture mode; just use the texture terr_rock6.jpg:
    material MyMaterial8
    {
    technique
    {
    pass
    {
    texture_unit
    {
    texture terr_rock6.jpg
    }
    }
    }
    }
    
  3. Compile and run the application. You should see a part of the stone texture that we had seen before.
    Time for action — preparing to scroll a texture

What just happened?

We are only seeing a part of the texture because our quad only has a texture coordinate that is going up to 0.2; this means four-fifths of the texture isn't rendered onto our quad. Everything that has happened in this Time for action — should be easy to understand, as it's just a repetition of the stuff we learned in this chapter up until now. If necessary, read the chapter again.

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

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