This post provides a DirectX 10 sample app that simply displays a square with a photo on it. (a quad with a texture map).
It uses C# and the SlimDX which is an excellent and lightweight way to use Direct X from .NET.
Although there is already a SlimDX sample to display a colored triangle, this sample demonstrates a few additional points:
- How to apply a texture (no it's not obvious at all!)
- How to use a quad instead of a triangle (again not obvious)
- Data is initialized using collections. This allows the geometry count to be defined in 0 places instead of 4 (it's implied by the collection count) which is less error prone when making data changes.
- Collections also make the code more readable because all data types such as Points can be declared as isolated groups rather than all types mixed together in one big array.
Visual Studio 2008 Sample Project:
Download SimpleTexturedQuad
I encourage anyone new to DirectX to learn version 10 because it's the foundation for both Vista and Windows 7, and significantly different than version 9 which you might be able to avoid altogether and save a lot of time.
Also a strong recommendation to use SlimDX and to not use C++ for DirectX if you have a choice. Even if you know C++ well it's just a huge drop in efficiency compared to a more modern language and environment like C#. In most cases the performance difference is very small.