Example #1
0
    public static void Main(string[] args)
    {
        // Create shaders:
        Shader solidRed  = new UnlitColorShader("red");
        Shader solidBlue = new UnlitColorShader("blue");
        Shader glass     = new GlassShader();

        // Create the models:
        Model cube   = new CubeModel(solidRed);
        Model monkey = new Suzanne(glass);

        // Draw the two models:
        cube.Draw();   // "Rendering Cube with a red color."
        monkey.Draw(); // "Rendering Suzanne to look like glass."

        // Switch out the shader on suzanne:
        monkey.SetShader(solidBlue);

        monkey.Draw(); // "Rendering Suzanne with a blue color."
    }