overlays in d3d9

Started by
1 comment, last by circlesoft 19 years, 6 months ago
I am new to directX and D3d. I am currently writing an app in D3D9. What is the best way to create overlays?. The size, shape and position of these overlays need to be dynamic, and created on the fly. My app is fairly simple, it uses one vertex buffer to draw the main image. All rendering is done with a drawprimitive call. ideally i would like to place the overlays into a second buffer, that would draw on top of the first one, with the proper transparancies set. please help. [Edited by - iota1410 on October 15, 2004 8:54:58 AM]
Advertisement
If I understand correctly, the only thing you're drawing is a single, full-screen, textured, untransformed triangle strip, and this is what you want to overlay on top of? Assuming you want to draw more little rectangles on top of this, you can create them in the same way you create your main primitive, at whatever size and position you want. Then, to make sure they overlay when you draw them, change the z-bias. device->SetRenderState(D3DRS_ZBIAS,1); See the DX docs for more info. (If you're not using untransformed vetices, they may be the answer to your question already.)
If this isn't exactly what you mean, you can also draw 3D shapes "on top" of your main primitive by using the stencil buffer, or the IDirect3DDevice::Clear function, and actually letting them show through from behind.
Finally, if all else fails, on most cards you can lock the back buffer and write whatever you want directly to it, but this is slightly slow for animation.
VideoWorks Softwarehttp://www.3dpoolpro.com
Here is a good tutorial on screen-space sprites.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement