Time for action — using textures in shaders
- Create a new material named
MyMaterial14
. Also create two new shaders namedMyFragmentShader2
andMyVertexShader2
. Remember to copy the fragment and vertex program definitions in the material file. Add to the material file a texture unit with the rock texture:texture_unit { texture terr_rock6.jpg }
- We need to add two new parameters to our fragment shader. The first is a two tuple of floats for the texture coordinates. Therefore, we also use the semantic to mark the parameter as the first texture coordinates we are using. The other new parameter is of type
sampler2D
, which is another name for texture. Because the texture doesn't change on a per fragment basis, we mark it asuniform
. This keyword indicates ...
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.