Let's write our first vertex and fragment shaders:
In our application, we only need to change the used material. Change it to
MyMaterial13
. Also remove the second quad:manual->begin("MyMaterial13", RenderOperation::OT_TRIANGLE_LIST);
Now we need to create this material in our material file. First, we are going to define the fragment shader. Ogre 3D needs five pieces of information about the shader:
The name of the shader
In which language it is written
In which source file it is stored
How the main function of this shader is called
In what profile we want the shader to be compiled
All this information should be in the material file:
fragment_program MyFragmentShader1 cg { source Ogre3DBeginnersGuideShaders.cg entry_point MyFragmentShader1 profiles ps_1_1 arbfp1 }
The vertex shader needs the same parameter, but we also have to define a parameter that is passed from Ogre 3D to our shader. This contains the matrix that we will use for transforming...