I'm trying to work with 2D graphics using Direct3D 9, but am not sure where to start. Right now I'm using a texture as the "draw buffer", and drawing that texture to screen. For the simplest things, it works. But I can't see a way to e.g. draw lines, arcs, and the like onto the texture. How should I go about doing this?
|
|
The GDI approach:
The Pixel approach:
The Render approach:
|
|||
|
|
|
Use Sprites in Direct3D 9. Very simple way of creating 2D objects in a 3D space. There's a tutorial here: Sprite Tutorial I've used sprites to create a 2D HUD in my 3D games and they turn out pretty well. To draw lines, just use the D3DPT_LINELIST or D3DPT_LINESTRIP primitives with DrawPrimitive(). Drawing Arcs might be a little bit more difficult. You could look into drawing Bezier curves for that: Bezier Curves |
|||
|
|