DirectX SDK |
Note The information in this topic applies only to applications written in C++. DirectX for Visual Basic does not support these device types.
Previous releases of DirectX supported two additional types of device, called the MMX device and the Ramp device. These devices are superseded in the current version of DirectX, but can still be accessed through legacy interfaces.
MMX is a special instruction set that some microprocessors support. It provides increased performance for multimedia and 3-D processing. Direct3D uses MMX support, if it is installed, to increase rendering speed.
MMX devices are not hardware-accelerated devices like HAL devices. The transformation, lighting, and rasterizing modules are completely implemented in software. However, MMX devices provide much better performance than other types of software-emulated Direct3D devices.
If your application uses the IDirect3D2 interface, it must explicitly create an MMX device. However, beginning with the IDirect3D3 interface, MMX and RGB devices implement exactly the same feature set (see RGB Device). If an application attempts to create an RGB device and the microprocessor supports MMX technology, Direct3D automatically creates an MMX device.
Your application creates an MMX device by invoking the IDirect3D3::CreateDevice method and passing the value IID_IDirect3DMMXDevice in the first parameter. For more information, see Creating a Direct3D Device. If the application explicitly requests that an MMX device is created and the user's computer does not support MMX technology, CreateDevice fails.
You cannot create a Direct3D ramp device by using the IDirect3D3 or IDirect3D7 interfaces, nor can you query an existing ramp device for the IDirect3DDevice3 or IDirect3DDevice7 interfaces. In short, ramp devices do not support any multiple texture blending options. For emulation of these features, use the MMX or RGB software emulation devices.
A ramp device is a software-emulated device that provides monochrome lighting. Applications can select it when the user's computer does not have sufficient processing power to support any other type of Direct3D devices. Ramp mode uses the full range of the transformation module but does not support colored lighting. A ramp mode device uses the Direct3D lighting module for monochrome gray-scale lighting only. Therefore, lights in ramp mode have intensity but no color. The gray-scale value is stored in the blue component of the light color.
Colored materials and textures can be used in ramp mode. Direct3D uses the material or texture color as its base color. If white light (full-intensity light) is shining on the material or texture, the base color is used. However, if the light strength is less than full intensity, Direct3D mixes gray or black into the color of the material or texture. If your application uses textures in ramp mode, it must set the D3DLIGHTSTATE_MATERIAL member of the legacy D3DLIGHTSTATETYPE enumerated type. Only 8-bit textures can be used in ramp mode.
To control the number of color values available for a material or texture in ramp mode, your application must set the dwRampSize member of the legacy D3DMATERIAL structure when it creates its materials. Direct3D uses the material and texture color as the base color. The value in the dwRampSize member determines how many gradients of the base color are available, depending on the brightness of the light. Direct3D creates a color palette with the number of entries (1-based) specified in the dwRampSize member. Since the maximum possible number of palette entries is less than 256 (256 minus the reserved colors that Windows uses), your application should specify the minimum number of gray-scale values required for the application.
For best results, make the ramp size for most or all of your application's materials the same value. When Direct3D runs out of palette entries, it searches through the existing materials to find the closest color match. Only materials with the same ramp size can be considered a match.
Ramp devices are provided primarily for backward compatibility with legacy applications. In general, computers that do not have sufficient processing power to support RGB devices are not suited to 3-D applications.
An application creates a ramp device by invoking the IDirect3D2::CreateDevice method and passing the value IID_IDirect3DRampDevice as the first parameter. For more information, see Creating a Direct3D Device.