Creating a 2D GUI using Direct3D
I'm creating a 2D GUI using Direct3D to take advantage of things like hardware acceleration and hardware alpha blending.
For anyone that's got experience with 2D rendering using Direct3D, I've got a couple of questions.
My GUI elements are packed into square number textures and I draw them to the screen by specifying a source rect from that texture and render them to texured quads. I wanted to have a go at making the rendered windows have an alpha transparency value. It turns out that because at the moment I'm rendering each element of a window directly from a Direct3D texture to the back buffer, I can't specify an alpha value for the whole window easily (only the individual elements). At first you might think all I have to do is specify the same alpha value for each element and it'll work. The problem occurs because some of the areas of a window are drawn over more than once (e.g a button drawn on top of a window background). So if you can imagine, this makes it difficult for me to make the entire window have an alpha value which is consistent.
Does anyone have any ideas on how to do this? I was thinking of maybe contructing the window on an off-screen surface and then rendering it to the back buffer from there, using one alpha value for the entire window. Wouldn't this be quite costly and slow?
I'm pretty much a beginner to D3D so I'm just looking for someone with a bit more experience than me to give me a few pointers.