|
我开了深度缓冲,可以通过Z来调节那张图显示在上面,那张图显示在下面。我想给精灵做一个透明度,思路就是draw(*pTexture,&rect,&D3DVECTOR3(center),&D3DVECTOR3(position),color0xffffffff) 最后的这个颜色的参数,我把alpha换成2f让精灵透明。。就是0x2fffffff,也确实图片有透明的感觉的了,但实质还是不透明的啊。。。。 怎么能真正的透明呢?上面的图片是透明的,就能看到下面的图,怎么做呢?
上代码及截图
- //-----------------------------------------------------------------------------
- // Name: Render()
- // Desc: Draws the scene
- //-----------------------------------------------------------------------------
- void Render()
- {
- // Clear the backbuffer to a blue color
- g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
- RECT rct = {0,0,512,512};
- // Begin the scene
- if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
- {
- if ( SUCCEEDED( g_pSprite->Begin(D3DXSPRITE_ALPHABLEND) ) )
- {
- g_pSprite->Draw(g_pTexture, &rct, NULL, &D3DXVECTOR3(100,100,0), 0x2fffffff);
- g_pSprite->End();
- }
- if ( SUCCEEDED( g_pSprite2->Begin(D3DXSPRITE_ALPHABLEND) ) )
- {
- g_pSprite2->Draw(g_pTexture2, &rct, NULL, &D3DXVECTOR3(0,0,1), 0x2fffffff);
- g_pSprite2->End();
- }
- // End the scene
- g_pd3dDevice->EndScene();
- }
- // Present the backbuffer contents to the display
- g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
- }
复制代码
怎么能让他真的透明,能透过上边的图片,看到下边的图片? |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|