Skip to main content
gamedev.net
🔒 Locked

Transparency

Started by vcGamer Mar 14, 2003 at 3:56 AM 0 replies 250+ views
Original Post
vcGamer
vcGamer
hi How can I make a transparent or translucent object in DirectX, for instance something like a ghost which has a color, and borders, but meanwhile I can see the behind?
Visit galaxyroad.com which soon will have english contents too
davidkosenina
davidkosenina
Helo

U must use Alpha blending. You just set render states like that:


// Alpha
pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

// Set how the texture should be blended (use alpha)
pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
pDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);


Then you load picture with D3DXCreateTextureFromFileEx(). And
render on the screen. And dont forget to set keyColor to 0 if you
are using .pnf or tga format.


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.