Using HLSL

One of the nicest features of the DirectX 9 release was something called the effects system, which utilizes HLSL. You might have even noticed that the project you're working on now declares (and uses) a variable of type Effect. This is the major entry point to the effects system and the easiest way to use HLSL to write your programs.

The effects system is designed to integrate both the vertex and pixel shader programs along with the pipeline state to render your objects. Most times, you have a text file that you pass into the effects system, and that file is compiled into the correct shader code, either at runtime or at build time, depending on how you've set it up. The basic layout of one of these files is like this:

 <Variable Declarations> ...

Get Beginning 3D 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.