markbiddlecom
Newcomer
OK, so I've been surfing a while for information on this, and I've come up miserably short:
I'm writing a simple top-down game engine with Direct3D 9, and I was going to just use GDI+ for some of the special effects drawing code, because I know how to work with it and I like the interfaces. Anyway, I found out pretty fast that you can't draw between the BeginScene and EndScene methods, which makes sense, but I was having initial success by drawing the graphics after executing the Present method.
At least, until I went to full screen view. Now, the GDI+ drawing never shows up at all. I've moved the code around, slept on the current thread after drawing, dealt with synchronous and asynchronous code, and I just can't figure out what's going on.
Anyway, I gave up on that to go deal with other issues (AI, scripting, etc.), and stumbled across some methods in the managed API that I thought would do the job for me: Device.getRenderTarget (returns a Direct3D.Surface object), Surface.getGraphics, and Surface.releaseGraphics. (Don't quote me on the names, but I think they're right.)
Well, I figured that I could grab a reference to one of the surfaces, snatch a graphics object from the surface, draw some old fashioned lines, and then release the graphics reference. The only problem, as I mentioned earlier, is that I can't find any documentation whatsoever. Microsoft's docs for getGraphics says "Returns a GDI+ Graphics instance," or something to that effect.
I've placed the code just about everywhere I can think of in relation to the BeginScene/EndScene/Present block, and I can't seem to execute the getGraphics method without getting a vague DirectX exception.
So it is that I found my way to this forum, and I'm practically on my knees here begging for help. It's either this or try to learn about whatever functionality the Direct3D API offers for drawing semitransparent lines and other such things. Or just move to GDI+ for the whole blasted engine...
Thanks in advance,
Mark
I'm writing a simple top-down game engine with Direct3D 9, and I was going to just use GDI+ for some of the special effects drawing code, because I know how to work with it and I like the interfaces. Anyway, I found out pretty fast that you can't draw between the BeginScene and EndScene methods, which makes sense, but I was having initial success by drawing the graphics after executing the Present method.
At least, until I went to full screen view. Now, the GDI+ drawing never shows up at all. I've moved the code around, slept on the current thread after drawing, dealt with synchronous and asynchronous code, and I just can't figure out what's going on.
Anyway, I gave up on that to go deal with other issues (AI, scripting, etc.), and stumbled across some methods in the managed API that I thought would do the job for me: Device.getRenderTarget (returns a Direct3D.Surface object), Surface.getGraphics, and Surface.releaseGraphics. (Don't quote me on the names, but I think they're right.)
Well, I figured that I could grab a reference to one of the surfaces, snatch a graphics object from the surface, draw some old fashioned lines, and then release the graphics reference. The only problem, as I mentioned earlier, is that I can't find any documentation whatsoever. Microsoft's docs for getGraphics says "Returns a GDI+ Graphics instance," or something to that effect.
I've placed the code just about everywhere I can think of in relation to the BeginScene/EndScene/Present block, and I can't seem to execute the getGraphics method without getting a vague DirectX exception.
So it is that I found my way to this forum, and I'm practically on my knees here begging for help. It's either this or try to learn about whatever functionality the Direct3D API offers for drawing semitransparent lines and other such things. Or just move to GDI+ for the whole blasted engine...
Thanks in advance,
Mark