How Do I ...?

The documents in this section show you how to accomplish commonly encountered development tasks in Microsoft DirectX.

The following tables list tasks available for DirectX feature areas using C# code examples.

Handle a Device (Direct3D)

Check for Shader Support This example shows how to check the hardware device for shader support.
Create an Additional Swap Chain This example demonstrates how to create an additional swap chain using the SwapChain class. Additional swap chains are useful for supporting multiple viewports; for example, a single window partitioned into four sub-windows, each with different views of the same scene.
Maintain Floating Point Precision after Device Creation When a Device object is created, the common language runtime will change the floating-point unit (FPU) to single precision to maintain better performance. To maintain the default double precision FPU, which is default for the common language runtime, use the CreateFlags.FpuPreserve flag when creating a Device object as in the sample code below.
Record and Apply StateBlocks This example demonstrates how to use state blocks to set and retrieve a device's state.

Render a 3-D Scene (Direct3D)

Draw A Sprite This example demonstrates how to draw a sprite.
Generate a Scene This example shows how to begin scene generation and draw primitives.
Render Mesh with Texture using HLSL This example demonstrates how to render a mesh texture using the high-level shader language (HLSL).
Set Up a Projection Matrix This example demonstrates how to set up the projection transformation matrix, which transforms 3-D camera or view space coordinates into 2-D screen coordinates.
Set Up a View Matrix This example demonstrates how to initialize the view transformation matrix, which transforms world coordinates into camera or view space.
Using an Effect This example demonstrates how to use an effect technique that was loaded from a file.

Use Meshes, Textures, and Effects (Direct3D)

Check For HDR Texture Support This example demonstrates how to check a device to determine whether a specific texture format is supported.
Clean a Mesh This example shows how to clean a mesh in preparation for simplification.
Clone a Mesh This example shows how to clone a mesh to add space for normals, texture coordinates, colors, weights, etc. that were not originally present.
Compute a Bounding Sphere from a Mesh This example shows how to generate a simple bounding sphere around a 3-D object, using the Geometry.ComputeBoundingSphere method.
Copy a Texture This example demonstrates how to copy a texture.
Create a Cube Texture This example demonstrates how to create a cube texture.
Create a Mesh Object This example shows how to create a Mesh object.
Save a Screenshot This example demonstrates how to save a screen shot to a file.
Simplify a Mesh This example demonstrates how to simplify a mesh.

Use Vertex and Index Buffers (Direct3D)

Create a Vertex Declaration This example demonstrates how to create a vertex declaration.
Read and Write VertexBuffer and IndexBuffer Data With GraphicsStreams This example demonstrates how to use GraphicsStream objects to fill and retrieve data from a VertexBuffer and IndexBuffer objects.
Read and Write VertexBuffer Data With Arrays This example demonstrates how to use arrays to fill and retrieve data from a VertexBuffer and IndexBuffer objects.

Use Effects on Sound (DirectSound)

Add Effects to a SecondaryBuffer Object This C# example demonstrates how to add effect objects to a SecondaryBuffer object.
Use Effect Parameters This C# example demonstrates how to use the parameters of an effect object from a SecondaryBuffer object.

Show:
© 2014 Microsoft