markbiddlecom
Member
OK, so Ive been surfing a while for information on this, and Ive come up miserably short:
Im 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 cant 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. Ive moved the code around, slept on the current thread after drawing, dealt with synchronous and asynchronous code, and I just cant figure out whats 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. (Dont quote me on the names, but I think theyre 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 cant find any documentation whatsoever. Microsofts docs for getGraphics says "Returns a GDI+ Graphics instance," or something to that effect.
Ive placed the code just about everywhere I can think of in relation to the BeginScene/EndScene/Present block, and I cant seem to execute the getGraphics method without getting a vague DirectX exception.
So it is that I found my way to this forum, and Im practically on my knees here begging for help. Its 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
Im 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 cant 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. Ive moved the code around, slept on the current thread after drawing, dealt with synchronous and asynchronous code, and I just cant figure out whats 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. (Dont quote me on the names, but I think theyre 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 cant find any documentation whatsoever. Microsofts docs for getGraphics says "Returns a GDI+ Graphics instance," or something to that effect.
Ive placed the code just about everywhere I can think of in relation to the BeginScene/EndScene/Present block, and I cant seem to execute the getGraphics method without getting a vague DirectX exception.
So it is that I found my way to this forum, and Im practically on my knees here begging for help. Its 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