flawlesslyfaulted
flawlesslyfaulted

Reputation: 57

How to get a fully transparent backbuffer in directx 9 without vista Desktop Window Manager

I currently have an activex control that initiates a media (video/audio) framework another development group in my company developed and I am providing a window handle to that code. That handle is being used by their rendering plugin in the pipeline that uses Direct3d for rendering the video using that handle.

I have seperate LPDIRECT3D9EX and LPDIRECT3DDEVICE9EX pointers that I initialize in my activex control. I am trying to clear a backbuffer to transparent and then use directx drawing primatives to draw on that backbuffer producing a transparent window with my drawing primatives over the streaming video on the directx surface below.

It appears that clearing a device backbuffer with full alpha transparency is ignored by directx.

d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 1, 0 /*full alpha*/), 1.0f, 0);

I can see the object I draw but they are drawn on top of a backbuffer that has the RGB color specified without the alpha value. The project linked (http://www.codeproject.com/KB/directx/umvistad3d.aspx) to in the stackoverflow question below does what I want but requires vista's Desktop Window Manager and won't work for XP.

How do I draw transparent DirectX content in a transparent window?

I have checked the capabilities using the DXCapsViewer.exe and the D3DFMT_A8R8G8B8 backbuffer format that I am using for the backbuffer is valid so it can't be that.

Has anyone gotten a transparent backbuffer in directx to work in XP?

Upvotes: 0

Views: 3835

Answers (1)

Goz
Goz

Reputation: 62333

The problem is that your back buffer contains alpha values your front buffer, however ... does not. You will need to lock your back buffer and copy the pixels to the layered window DC. Do be warned though ... this WILL be slow.

Edit: In answer to your questions in the comment.

1) The point of alpha values in the back buffer is for alpha testing and blending
2) (See answer 1)
3) No I'm saying ignore the front buffer and get the back buffer.
4) What direct x object in use by the media frame work? There is no such thing. DirectShow != Direct3D whatever 99% of people seem to think ...

Upvotes: 1

Related Questions