The secret to creativity is knowing how to hide your sources.
- Albert Einstein
 
   
 

2D Blits in DirectX 9

Posted by Karel Donk on Sunday, April 10th, 2005

The sample code provided in the ZIP file below illustrates how you can do 2D blits in DirectX 9. Starting from DirectX 8 Microsoft removed all 2D code from DirectX. The advice that they gave people wanting to use the 2D features was that those people should use DirectX 7 whenever they wanted to use the 2D functions. Ofcourse that was not an option if you needed the functionality provided in DirectX 8 and DirectX 9.

So while I was in the technical beta testing team for DirectX 8 I decided to write some sample code which would show how you can get direct access to the D3D surfaces and do 2D blits on them. You would have to write all the 2D functions yourself, but using my code as a starting point, that would be easy to do. In addition my code also illustrates how to do conversion between the various surface formats introduced in DirectX 8 and 9.

Ofcourse when direct access to the surfaces is not needed you would be better off using the standard D3D blitting routines, which are hardware accelerated and as a result are faster than the software 2D blits in my code. For more information please see the readme.txt file provided in the zip file.

Download Source Code.

 
 
PhotoShelter - See the world through my eyes
latest posts
monthly archives
categories
Links
companies i like
Microsoft
A clear vision on software.


Alienware
For the best computersystems on this planet.


Google
Superior services and great ideas.