d3d9.dllBegin
Microsoft DirectX 9.0 SDK Update (October 2004)

ID3DXSprite::Begin Method


Prepares a device for drawing sprites.

Syntax

HRESULT Begin(      

    DWORD Flags );

Parameters

Flags
[in] Combination of zero or more flags that describe sprite rendering options. For this method, the valid flags are:
  • D3DXSPRITE_ALPHABLEND
  • D3DXSPRITE_BILLBOARD
  • D3DXSPRITE_DONOTMODIFY_RENDERSTATE
  • D3DXSPRITE_DONOTSAVESTATE
  • D3DXSPRITE_OBJECTSPACE
  • D3DXSPRITE_SORT_DEPTH_BACKTOFRONT
  • D3DXSPRITE_SORT_DEPTH_FRONTTOBACK
  • D3DXSPRITE_SORT_TEXTURE
For a description of the flags and for information on how to control device state capture and device view transforms, see D3DXSPRITE.

Return Value

If the method succeeds, the return value is S_OK.

If the method fails, the return value can be one of the following:

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
D3DERR_OUTOFVIDEOMEMORYMicrosoft Direct3D does not have enough display memory to perform the operation.
D3DXERR_INVALIDDATAThe data is invalid.
E_OUTOFMEMORYDirect3D could not allocate sufficient memory to complete the call.


Remarks

This method must be called from inside a IDirect3DDevice9::BeginScene . . . IDirect3DDevice9::EndScene sequence. ID3DXSprite::Begin cannot be used as a substitute for either IDirect3DDevice9::BeginScene or ID3DXRenderToSurface::BeginScene.

This method will set the following states on the device.

Render States:

Type (D3DRENDERSTATETYPE)Value
D3DRS_ALPHABLENDENABLETRUE
D3DRS_ALPHAFUNCD3DCMP_GREATER
D3DRS_ALPHAREF0x00
D3DRS_ALPHATESTENABLEAlphaCmpCaps
D3DRS_BLENDOPD3DBLENDOP_ADD
D3DRS_CLIPPINGTRUE
D3DRS_CLIPPLANEENABLEFALSE
D3DRS_COLORWRITEENABLED3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED
D3DRS_CULLMODED3DCULL_NONE
D3DRS_DESTBLENDD3DBLEND_INVSRCALPHA
D3DRS_DIFFUSEMATERIALSOURCED3DMCS_COLOR1
D3DRS_ENABLEADAPTIVETESSELLATIONFALSE
D3DRS_FILLMODED3DFILL_SOLID
D3DRS_FOGENABLEFALSE
D3DRS_INDEXEDVERTEXBLENDENABLEFALSE
D3DRS_LIGHTINGFALSE
D3DRS_RANGEFOGENABLEFALSE
D3DRS_SEPARATEALPHABLENDENABLEFALSE
D3DRS_SHADEMODED3DSHADE_GOURAUD
D3DRS_SPECULARENABLEFALSE
D3DRS_SRCBLENDD3DBLEND_SRCALPHA
D3DRS_SRGBWRITEENABLEFALSE
D3DRS_STENCILENABLEFALSE
D3DRS_VERTEXBLENDFALSE
D3DRS_WRAP00

Texture Stage States:

Stage IdentifierType (D3DTEXTURESTAGESTATETYPE)Value
0D3DTSS_ALPHAARG1D3DTA_TEXTURE
0D3DTSS_ALPHAARG2D3DTA_DIFFUSE
0D3DTSS_ALPHAOPD3DTOP_MODULATE
0D3DTSS_COLORARG1D3DTA_TEXTURE
0D3DTSS_COLORARG2D3DTA_DIFFUSE
0D3DTSS_COLOROPD3DTOP_MODULATE
0D3DTSS_TEXCOORDINDEX0
0D3DTSS_TEXTURETRANSFORMFLAGSD3DTTFF_DISABLE
1D3DTSS_ALPHAOPD3DTOP_DISABLE
1D3DTSS_COLOROPD3DTOP_DISABLE

Sampler States:

Sampler Stage IndexType (D3DSAMPLERSTATETYPE)Value
0D3DSAMP_ADDRESSUD3DTADDRESS_CLAMP
0D3DSAMP_ADDRESSVD3DTADDRESS_CLAMP
0D3DSAMP_MAGFILTERD3DTEXF_ANISOTROPIC if TextureFilterCaps includes D3DPTFILTERCAPS_MAGFANISOTROPIC; otherwise D3DTEXF_LINEAR
0D3DSAMP_MAXMIPLEVEL0
0D3DSAMP_MAXANISOTROPYMaxAnisotropy
0D3DSAMP_MINFILTERD3DTEXF_ANISOTROPIC if TextureFilterCaps includes D3DPTFILTERCAPS_MINFANISOTROPIC; otherwise D3DTEXF_LINEAR
0D3DSAMP_MIPFILTERD3DTEXF_LINEAR if TextureFilterCaps includes D3DPTFILTERCAPS_MIPFLINEAR; otherwise D3DTEXF_POINT
0D3DSAMP_MIPMAPLODBIAS0
0D3DSAMP_SRGBTEXTURE0

Note  This method disables N-patches.

See Also

ID3DXSprite::End, D3DXSPRITE


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.