Mixing 2D with 3D - best approach?

Started by
0 comments, last by MasterWorks 19 years, 3 months ago
Hi all, I wish to create (among other things) a grid as a background to my 3d scene. I've spent an unbelievable amount of time for what I thought should be a simple task, and I'm still no further ahead, so I'm asking, no, _pleading_ for HEEEELP! Here's what I've tried: 1. "Line.Draw()" Having finally worked out "Line.Draw()" from the non-existent microsoft documentation for this method, it turns out that anything rendered with Line.Draw() will appear ON TOP of any other elements rendered between the begin & end scene commands, no matter what order I render the 2d & 3d elements. Obviously this is of no use for me, as I want the grid to appear BEHIND the 3d objects. 2. "Line.DrawTransformed()" I imagine will have the same problem as "Line.Draw()", but I can't even get it to work at all. (I have no idea what should go in as the transform argument... I've tried world/view/projection transform matrices and varios combinations of them). 3. GDI I can't work out how to mix GDI stuff with a 3d scene on the same device, as the scene continually erases whatever is drawn behind it. Is there any way of conmbining GDI & DirectX? Or is this just an insane idea? 4. Drawing line lists using a vertex buffer. This works okay, but seems like a huge overhead just for drawing 2D lines on the screen. Also, to get the lines to appear BEHIND everything, it seems I'd have to either work out the most distant object in the scene, and make the lines' distance away from the camera even further, or just take a stab and provide a hugely large Z-axis co-ordinate (or whatever) to make sure the lines are actually behind all my 3d objects. None of these methods work entirely to my liking, and I'm sure there's got to be a simpler way to draw a grid (and other widgets) on my 3d device. Can anyone point me in the right direction? Please?!? Thanks in advance, Jon :-)
Advertisement
Use textured quads... for a grid you can make a texture (photoshop, etc) that repeats and then use texture coordinates (0,0) (10,10) on a screen transformed quad to make it tile 10 times. Lines, dots, etc. might not behave at all alike across different hardware from what I've read. Mixing GDI, etc. is not really a valid approach if you care about FPS. Everything should be a batched, textured poly of some sort.

This topic is closed to new replies.

Advertisement