Manually Transforming Vertices

You can use three different kinds of vertices in your Direct3D application. Read Vertex Formats for more details on the vertex formats:

Untransformed, unlit vertices
Vertices that your application doesn't light or transform. Applications that neither transform nor light vertices before rendering a scene can use D3DVERTEX vertices (or an equivalent flexible vertex format). Although you specify lighting parameters and transformation matrices, Direct3D does the math.
Untransformed, lit vertices
Vertices that your application lights but does not transform. Applications that use customized lighting effects might use D3DLVERTEX vertices (or an equivalent flexible vertex format).
Transformed, lit, vertices
Vertices that your application both lights and transforms. Applications that transform and light vertices on their own might use D3DTLVERTEX vertices (or an equivalent flexible vertex format). These vertices skip the transformations in the geometry pipeline altogether but they can be clipped by the system if needed. If your application clips vertices itself, you can get the best performance by specifying the D3DDP_DONOTCLIP flag when calling a rendering method. If you want Direct3D to clip vertices, omit the D3DDP_DONOTCLIP flag. Note that if you request Direct3D clipping on transformed and lit vertices, the system back-transforms them to camera space for clipping, then transforms them back to screen space, incurring processing overhead.

Direct3D includes two ways to change from simple to complex vertex types: the TransformVertices method that has been available since Direct3D was created, and vertex buffers, introduced in DirectX 6.0. The latter is the most efficient method, as vertex buffers are optimized to exploit processor specific features.

Using TransformVertices

You can use the IDirect3DViewport3::TransformVertices method to transform either the D3DVERTEX and D3DLVERTEX vertex types into screen coordinates, which are represented by D3DTLVERTEX vertices.

TransformVertices uses the current matrix (that you set with a call to the IDirect3DDevice3::SetTransform method) to perform the transformation. You might call TransformVertices if you want to transform but not necessarily render a set of vertices; for example, you might provide two vertices that define the opposite corners of a bounding box. If both vertices are clipped, you could forgo any further processing for that model.

The TransformVertices does not perform lighting. If you pass D3DVERTEX vertices, the resulting D3DTLVERTEX vertices will not have valid diffuse and specular components. Likewise, if you pass D3DLVERTEX vertices, the diffuse and specular components you provide with each vertex will be unchanged after TransformVertices returns.

Although managing the transformations yourself can be faster than calling the IDirect3DViewport3::TransformVertices method, implementing your own transformation engine can be time consuming, and TransformVertices is reasonably fast. If you need more control over the geometry pipeline than you get when using D3DVERTEX or D3DLVERTEX vertices, but you don't want to develop your own transformation engine, calling TransformVertices is a good compromise.

Note:  Applications often use TransformVertices to perform visibility checking, because the call returns clipping information in the associated D3DTRANSFORMDATA structure. Although accurate, visibility checking is best performed by calling the IDirect3DDevice3::ComputeSphereVisibility method, which was specially designed and optimized for this purpose.

Using Vertex Buffers

Vertex buffers are objects used to efficiently contain and process batches of vertices for rapid rendering. Vertex buffers offer the IDirect3DVertexBuffer::ProcessVertices method to perform vertex transformations for you; this is usually much faster than the TransformVertices method. The ProcessVertices method accepts only untransformed vertices, and can optionally light and clip vertices as well. Lighting is performed at the time you call ProcessVertices, but clipping is actually performed at render time.

After processing the vertices, you can use special rendering methods to render the vertices, or you can access them directly by locking the vertex buffer memory. For more information about using vertex buffers, see Vertex Buffers.