• Advertisement
Sign in to follow this  

Transparent Surface ?

This topic is 3293 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I am trying to just draw 2 surfaces with transparency. (Without using SDL) I know how to draw the same thing with textures and quads and all that. But, I just want to know if what I am trying should work, and maybe I am missing some setup steps. 1) I set the back buffer to use A8R8G8B8 2) Then I do CreateOffscreenPlainSurface 3) Next, to load the image I use D3DXLoadSurfaceFromFile and pass the key for transparency. 4) I use UpdateSurface with the offscreen surface and the back buffer. Result: I get the image on the screen, and the image's transparent color is filled with black. (That's semi good news since it's supposed to be filled with transparent black.) But, why isn't it transparent? Init Code:
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
...
g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true);
g_pd3dDevice->SetRenderState(D3DRS_ZENABLE, true);
g_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);    

Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
IDirect3DDevice9::UpdateSurface won't use hardware alpha-blending, since it'll just do a straight copy of the source data to the destination surface. If you want blending you'll have to actually render primitives and use textures.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement