Using HLSL to Write a Pixel Shader

So far you've manipulated the vertices and written vertex programs, but that's only half the fun when dealing with the programmable pipeline. What about the color of each individual pixel? For this example, we will take the MeshFile example you wrote back in Chapter 5, “Rendering with Meshes,” and update it to use the programmable pipeline instead. This one is being used because not only does it render vertices, but they are colored from a texture where a pixel shader could be used.

After loading this project, you will need to make a few changes to the source to begin using the programmable pipeline. First, you will need the variables to store the transformations and effect object, so add those:

 private Effect ...

Get Managed DirectX® 9 Kick Start: Graphics and Game Programming 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.