Original Post
Is it neccessary to treat a hud completely differently from the 3d objects in your scene? I'm hoping to avoid having to treat them as a special case. I was also hoping to have the hud as children of the camera, so that I could easily swap cameras and not have to change the hud around, which would be greatly simplified by being able to treat them as standard game objects. My main problem I guess is deciding on a clean way to handle setting and resetting the projection matrix for 2d. Currently my rendering code looks something like this: Somewhere in initialization:
D3DXMATRIXA16 projection;
D3DXMatrixPerspectiveFovLH(&projection, ...);
device->SetTransform(D3DTS_PROJECTION, &projection);
device_->Transform(D3DTS_VIEW, camera_->ViewTransform());
for each Object o in scene:
device->SetTransform(D3DTS_WORLD, o->WorldTransform());
o->Draw();
Object's Draw method delegates to a Drawable member class: Object::Draw() { drawable->Draw(); } Any suggestions on how to handle overlays/2d elements in a generic way? Where should all those transform calls be? When and where should I set up the orthographic projection? I have some ideas but I'm not terribly happy with any of them, so I'd appreciate some input.