ID3DXSprite interface

The ID3DXSprite interface provides a set of methods that simplify the process of drawing sprites using Microsoft Direct3D.


The ID3DXSprite interface inherits from the IUnknown interface. ID3DXSprite also has these types of members:


The ID3DXSprite interface has these methods.

Method Description
Begin Prepares a device for drawing sprites.
Draw Adds a sprite to the list of batched sprites.
End Calls ID3DXSprite::Flush and restores the device state to how it was before ID3DXSprite::Begin was called.
Flush Forces all batched sprites to be submitted to the device. Device states remain as they were after the last call to ID3DXSprite::Begin. The list of batched sprites is then cleared.
GetDevice Retrieves the device associated with the sprite object.
GetTransform Gets the sprite transform.
OnLostDevice Use this method to release all references to video memory resources and delete all stateblocks. This method should be called whenever a device is lost or before resetting a device.
OnResetDevice Use this method to re-acquire resources and save initial state.
SetTransform Sets the sprite transform.
SetWorldViewLH Sets the left-handed world-view transform for a sprite. A call to this method is required before billboarding or sorting sprites.
SetWorldViewRH Sets the right-handed world-view transform for a sprite. A call to this method is required before billboarding or sorting sprites.



The ID3DXSprite interface is obtained by calling the D3DXCreateSprite function.

The application typically first calls ID3DXSprite::Begin, which allows control over the device render state, alpha blending, and sprite transformation and sorting. Then for each sprite to be displayed, call ID3DXSprite::Draw. ID3DXSprite::Draw can be called repeatedly to store any number of sprites. To display the batched sprites to the device, call ID3DXSprite::End or ID3DXSprite::Flush.

The LPD3DXSPRITE type is defined as a pointer to the ID3DXSprite interface.

typedef interface ID3DXSprite ID3DXSprite;
typedef interface ID3DXSprite *LPD3DXSPRITE;


Requirement Value

See also

D3DX Interfaces