Original Post
I am recently build up my own Game engine using DX 9,Now I've switched to render system, and I planned to have two versions, one for 2D and the other for 3D.
For 2D rendering. I wonder that whether AlphaBlend has to do with IDirect3DSurface9? I used the following code:
But when comes to rendering, the alphablend doesn't work. It seems that alphablend has not to do with IDirect3DSurface9.
How could I solve the problem?
For 2D rendering. I wonder that whether AlphaBlend has to do with IDirect3DSurface9? I used the following code:
// ???????
if ( FAILED( g_pDevice->CreateOffscreenPlainSurface(
clientWidth, // ?
clientHeight, // ?
D3DFMT_X8R8G8B8, // D3D??
D3DPOOL_SYSTEMMEM, // ?????
&g_pSurface, // ??????????
NULL/*????*/ ) ) ) return;
// ????????
if ( FAILED( D3DXLoadSurfaceFromFile(
g_pSurface, // ????
NULL, // ?????
NULL, // ????
"?????.png", // ?????
NULL, // ???
D3DX_DEFAULT, // ???
D3DCOLOR_XRGB( 0, 0, 0 ), // ????????
NULL/*?????*/ ) ) ) return;
// ??Alpha??
g_pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
g_pDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
g_pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
But when comes to rendering, the alphablend doesn't work. It seems that alphablend has not to do with IDirect3DSurface9.
How could I solve the problem?