Sample Code - Graphics
All projects that include source code were created using Microsoft Visual Studio. Some downloads include Visual Studio .NET 2003 and 2005 projects.
DirectX Sprite
ID3DXSprite - An example of setting up and rendering a sprite. The source code is a single file (main.cpp) that is a very simple win32 application that initializes DirectX. Watch out because the code does not enumerate all video settings nor does it try to find the best directx device settings. I just picked one! :)
The tremendously cute image is my daughter!
ID3DXSprite, D3DXCreateTextureFromFileEx, D3DXCreateSprite, GetAdapterDisplayMode, CheckDeviceFormat, GetDeviceCaps, CreateDevice, LPDIRECT3DTEXTURE9, LPDIRECT3DDEVICE9, LPDIRECT3D9

Download (Binaries and source code - C++ DirectX 9.x)
DirectX 9 Skybox Demo
Creates 6 quads with 6 separate textures to make a skybox.

Download (Binaries and source code - C++ DirectX 9.x)
DirectX 9 Crosshairs Demo
This a another single file source code demo which shows how to load a transparent texture and display is correctly on screen. This is a simple win32 application which initializes DirectX, loads a texture that has an alpha channel, creates a screen quad and renders the texture to the quad.
Be aware that the graphic nature of this demo is nothing to write home about but hopefully I stripped out enough code to show the basics.

Download (Binaries and source code - C++ DirectX 9.x - VS 2003/2005)
DirectX Skybox, Mesh and Texture Crosshairs Demo
This sample demonstrates how to create a simple sky box, it draws the famous DirectX teapot with lighting and a material and it draws a screen space crosshair using Alpha Testing. I also set up one light.
LPD3DXMESH, D3DMATERIAL9, D3DLIGHT9, DrawPrimitive, SetRenderState, D3DXCreateTextureFromFileEx, D3DXCreateSprite, GetAdapterDisplayMode, CheckDeviceFormat, GetDeviceCaps, CreateDevice, LPDIRECT3DTEXTURE9, LPDIRECT3DDEVICE9, LPDIRECT3D9

Download (Binaries and source code - C++ DirectX 9.x - VS 2003/2005)
Particle Generator
ParticleSystem - I wanted a particle generator for my latest game (in progress) so I made one. Here is a simple Win32 and Direct3D app that demonstrates my particle system. The image does not do that app. justice you need to see the animation.
- Features:
- texture pattern
- particle colors
- change velocity, forces acting on particles
- update time to spray or create more particles
- specify max number of particles
- factor for how much pattern spread you want
- change number of particles that get created at a time inbetween update time to spray more particles
This demo has 3 particle generators running simultaneously (white fountain, blue, tight spray fountain, and a red fireworks blast) Memory limitations and the number of active vertex buffers will limit you. I suppose I could write a smarter vertex buffer management scheme.
Technology:
I use directX's Point Sprites for the individual particles. Using point sprites is not the best way to do it but they are better than the old way which is textured billboard, quads you have to manage yourself. The best way is the latest way to do particles which uses shaders to draw the particles. I kept shaders out of this app for now. Not all video cards support point sprites so beware. I may do another particle generator that uses billboard quads to that I can make more smoke looking effects. But this was a start. Enjoy! Source code is included.

Download (C++ DirectX 9.x)
Particle Generator II - Smoke Demo
This particle engine is different from the one above (ParticleGen).
This particle effect engine uses XML based configuration files that hold all necessary information needed to render different kinds of particle effects. This demo only shows one effect but you can tweak the XML file to create other effects.
Particle effect code modified from the SAGE engine. The source code uses TinyXml xml parser library to parse the pre-created effect file.
- Features:
- smoke (various colors and density)
- ground dust from bullet fire
- explosions
- muzzle blast
Download (Binaries only - C++ DirectX 9.x)
Coming soon! Download (Source code - C++ DirectX 9.x)
DX9Effects Demo
This sample demonstrates how to set some of the fixed function pipeline render states using the ID3DXEffect effect file interface instead of hardcoding the states in code. It loads and renders the infamous teapot.x mesh.
Download (Binaries and Source code - C++ DirectX 9.x)



