alpha blending surface

Started by
2 comments, last by MJP 14 years, 5 months ago
Hi, I was trying to put a surface in front of another surface to do alpha blending. To put the surface in front, I was using StretchRectangle wich I recently discover that it doesn't care about the alpha channel :( I create the front surface format as A8R8G8B8, I do Present.Clear (of the front surface) using Color.FromArgb(0, 0, 0, 0) I'm not using textures to fill the surfaces, only real-time rendering it's possible to do this ? Any ANY help is welcome, i'm really stuck here Thanks !
Advertisement
If you want to use hardware alpha-blending, then you need to create a texture (not just a surface) and draw geometry that samples that texture. ID3DXSprite makes this very easy to do, it will let you draw a texture at location in screen space.
Thanks ! but how can I draw to a texture ? is this that you said with "draw geometry that samples that texture" right ???
You can create a render target texture by calling IDirect3DDevice9::CreateTexture and passing D3DUSAGE_RENDERTARGET. Then to render to that texture, get the top-level surface using IDirect3DTexture9::GetSurfaceLevel.

This topic is closed to new replies.

Advertisement