DXUT Overview

This topic gives a high-level introduction to the DXUT Overview.

Overview

The framework is designed to help the programmer spend less time worrying about how to create a window, how to create a device, how to process Windows messages, or when to handle device events.

Here is an example main function of an application using the framework:

INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, INT )
{
    // Set the callback functions. These functions allow DXUT 
    // to notify the application about device changes, user input, and window
    // messages. The callback functions are optional, so you need only set 
    // them for events you are interested in.
    DXUTSetCallbackDeviceCreated( OnCreateDevice );
    DXUTSetCallbackDeviceReset( OnResetDevice );
    DXUTSetCallbackDeviceLost( OnLostDevice );
    DXUTSetCallbackDeviceDestroyed( OnDestroyDevice );

    DXUTSetCallbackFrameRender( OnFrameRender );
    DXUTSetCallbackFrameMove( OnFrameMove );

    // Initialize DXUT and create the desired Win32 window and 
    // Direct3D device for the application. Calling each of these functions is 
    // optional, but they allow you to set several options which control the 
    // behavior of the framework.
    DXUTInit( TRUE, TRUE, TRUE );
    DXUTCreateWindow( L"BasicHLSL" );
    DXUTCreateDevice( D3DADAPTER_DEFAULT, TRUE, 640, 480 );

    // Pass control to DXUT for handling the message pump and 
    // dispatching render calls. The framework will call your OnFrameMove and
    // OnFrameRender callback functions when there is idle time between 
    // handling window messages.
    DXUTMainLoop();

    return DXUTGetExitCode();
}

In the example code above, the framework does most of the work. It creates a window, creates a device, handles the main loop, and uses the application-supplied callback functions when events occur, such as device reset or frame render. The framework is modular, and the application can use all of the framework features or just the parts desired.

The remainder of this programming guide covers each of these steps in detail and looks at the choices the application has available to control or replace each step.

Further details on syntax and usage of functions, callback functions, structures, enumerations, and constants can be found in DXUT Reference.

Features

The framework provides the following services to help you create an application:

Limitations

For ease of use, the framework supports only a single window attached to a single device. Advanced applications that need to use multiple devices simultaneously or that need to display multiple Direct3D windows are not supported by the framework. However, most typical applications should be able to use the framework.

Starting a New Project

The easiest way to start a new Visual Studio .NET development project using DXUT is to do the following:

  1. Launch the sample browser, located in the DirectX SDK in the following location:

    (SDK root)\Samples\SampleBrowser\

  2. In the browser, select an existing Direct3D sample project that will be a starting point.
  3. Click on the "Install Project" link next to that project to copy the Visual Studio .NET project files to a new directory location.
  4. You can also optionally rename the project, in which case the sample browser will change the appropriate files and source code to give the project the new name.

DXUT Improvements in the DirectX April 2005 SDK

Based on customer feedback, the framework was improved in the DirectX April 2005 SDK Update. The following is a list of major differences and improvements.

DXUT Changes from the DirectX Summer 2003 SDK

The new framework is significantly redesigned from DXUT that shipped in the DirectX Summer 2003 SDK Update. The following is a list of major differences and improvements.