Friday, March 5, 2010

Mixing D3D Rendering and GDI

I tried my first solution to render a 3d scene to transparent window,
that is, get the desktop bitmap with GDI then render 3d on it. The
performance is bad.

So I tried the second solution, which is more or less a common
practice, to render on a texture then get it's surface then get the
device context of the surface. This DC can then be used for GDI
rending. To make transparent effect, just use a layered window with a
transparent color key and use the same color for the transparent part
in the texture. Also I need to use UpdateLayeredWindow onstead of
standard GDI rendering in WM_PAINT.

There are some tech details I need to solve in order to use it freely
with different types of textures.

No comments: