Advertisement Jump to content


This topic is now archived and is closed to further replies.


direct3d overlay

This topic is 5394 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

I want to draw over an existing window without interfering with the message handler or drawing of that window. is this possible in direct3d? I''ve tried some things, but the window rendering gets all glitchy between its own and my rendering. / erik

Share this post

Link to post
Share on other sites
What have you tried, exactly? Also, is the game that you are trying to render on top use Direct3D, and if so, which version (you will need to know the exact one).

You could try hooking into the program, replace their LPDIRECTD3DEVICE* with yours, and go from there. You would make your own version of LPDIRECT3DDEVICE* (just inherit it), and have your rendering code in Present() or something. For help with hooking, check this out.

Dustin Franklin
Mircrosoft DirectX MVP

Share this post

Link to post
Share on other sites
It''s possible to use overlays but:
- If you use DirectDraw7 overlays, you''ll either have to
a) Use D3D7 for rendering to surfaces before blitting them to the overlay (not sure that''d work)
b) Use D3D9 and lock both the back-buffer and the overlay surface,
and copy your data. The reading from the back-buffer and the writing to the overlay are very slow and slow, respectively.

- If you use DShow, I think you can build a source-filter that supplies back-buffer data. Don''t know how the performance would look like.

Have you tried creating the device with the target window handle?

Muhammad Haggag,
Bitwise account: MHaggag -

Share this post

Link to post
Share on other sites
this is what I use to initialize dx9.
rdPtr->hWnd is the target window.

if(NULL == (rdPtr->direct3D = Direct3DCreate9(D3D_SDK_VERSION)))
return -1;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
if(FAILED(rdPtr->direct3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, rdPtr->hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &rdPtr->direct3DDevice)))
return -1;

I then use this to render some text:

rdPtr->direct3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(255,255,255), 1.0f, 0);
RECT rc;
rc.left = 100; = 100;
rc.bottom = 200;
rc.right = 300;
rdPtr->font->DrawText(NULL, "Test string", 11, &rc, 0, D3DCOLOR_XRGB(0, 0, 0));
rdPtr->direct3DDevice->Present(NULL, NULL, NULL, NULL);

it''s drawn correctly but it flickers because it is overdrawn by the window.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!