Game Development Reference
In-Depth Information
lighting algorithm that can be implemented in a vertex shader. We are
no longer limited to Direct3D's fixed lighting algorithm. Furthermore,
the ability to manipulate a vertex's position has a variety of applications
as well, such as cloth simulation, point size manipulation for particle
systems, and vertex blending/morphing. In addition, our vertex data
structures are more flexible and can contain much more data in the pro-
grammable pipeline than they could in the fixed function pipeline.
Vertex shaders are still a relatively new feature, and many cards do
not support them, especially the newer vertex shader versions that
were released with DirectX 9. You can test the vertex shader version
that your graphics card supports by checking the VertexShader-
Version member of the D3DCAPS9 structure and the macro
D3DVS_VERSION . The following code snippet illustrates this:
// If the device's supported version is less than version 2.0
if( caps.VertexShaderVersion < D3DVS_VERSION(2, 0) )
// Then vertex shader version 2.0 is not supported on this
// device.
We see that the two parameters of D3DVS_VERSION take the major
and minor version number, respectively. Currently, the D3DXCompile-
ShaderFromFile function supports vertex shader versions 1.1 and
2.0.
Objectives
To learn how we define the components of our vertex structure in
the programmable pipeline
To learn about the different usages for vertex components
To learn how to create, set, and destroy a vertex shader
To learn how to implement a cartoon rendering effect using a ver-
tex shader
17.1 Vertex Declarations
Thus far, we have been using a flexible vertex format (FVF) to describe
the components of our vertex structure. However, in the programmable
pipe, our vertex data can contain much more data than can be
expressed with an FVF. Therefore, we usually use the more descriptive
and powerful vertex declaration .
Team-Fly ®
Search WWH ::




Custom Search