Rendering Shader Programs with Techniques

Now that you have the vertex program written, how can you actually use it? There isn't an “entry point” into the vertex program, just a method somewhere. How do you get this method called, though? Quite simply, you can use something called a “technique.” A technique consists of one to many passes, where each pass can set device state and set the vertex and pixel shaders to use your HLSL code. Look at the technique you can use for this application. Add this to your simple.fx file:

technique TransformDiffuse
    pass P0
        CullMode = None;

        // shaders
        VertexShader = compile vs_1_1 Transform();
        PixelShader  = NULL;

Here, you've declared a technique called TransformDiffuse, since this method will transform ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.