"SlimDX:D3D11 & Direct2D Interop"
#1 Members - Reputation: 100
Posted 19 June 2011 - 06:51 PM
#3 Members - Reputation: 551
Posted 20 June 2011 - 12:50 PM
And thanks for answering, Mike.
But that's absolutely ridiculous... "Stupid" isn't quite the word for it I'm afraid, Mike. Damn you, Microsoft!
So where does that leave us?
A) Use a D3D11 AND a D3D10.1 Device? No way...what a waste of resources and super sloppy code...
B) Use DXUT? Nope... I'm using SlimDX, and have written my own some-what complete engine. Sloppy hack-n-splice would be the only way, and I'm not fond of that idea.
C) Hack DirectX itself? lol...
So how the heck can we render simple text and sprites without doing something really whacky, sloppy and wasteful? Am I going to be stuck writing my own 2D rendering API that can spit pixels onto my back-buffer, just to get a decent, clean 2D interface?
The only other thing I can think of is writing something that will rasterize fonts and sprites into a texture and putting them on a 3D quad with an orthographic matrix. I don't like that idea either.
So WTF, Microsoft? What do you expect us to do for 2D graphics?
CEO & Lead Developer at ATCWARE™
"Project X-1"; a 100% managed, platform-agnostic game & simulation engine
Please visit our new forums and help us test them and break the ice!
___________________________________________________________________________________
#4 Members - Reputation: 358
Posted 20 June 2011 - 02:19 PM
http://www.rufelt.com/fw1fontwrapper/
It uses DirectWrite (and thus Direct2D) to create the fonts. Works like a charm
#5 Members - Reputation: 100
Posted 20 June 2011 - 03:25 PM
So where does that leave us?
A) Use a D3D11 AND a D3D10.1 Device? No way...what a waste of resources and super sloppy code...
B) Use DXUT? Nope... I'm using SlimDX, and have written my own some-what complete engine. Sloppy hack-n-splice would be the only way, and I'm not fond of that idea.
C) Hack DirectX itself? lol...
So how the heck can we render simple text and sprites without doing something really whacky, sloppy and wasteful? Am I going to be stuck writing my own 2D rendering API that can spit pixels onto my back-buffer, just to get a decent, clean 2D interface?
The only other thing I can think of is writing something that will rasterize fonts and sprites into a texture and putting them on a 3D quad with an orthographic matrix. I don't like that idea either.
So WTF, Microsoft? What do you expect us to do for 2D graphics?
A) I find using two devices rather elegant. I'm working on a UI library that uses Direct2D and DirectWrite with SlimDX. Direct2D alone isn't versatile enough to handle custom blending and shader effects, so my drawing model is split into Direct2D drawing and Direct3D composition all on its own Direct3D 10.1 device. Most Direct2D drawing is cached in dynamic texture atlases for speed. Ultimately, whatever is being drawn is composited onto a shared and synchronized texture. The other device simply calls OpenSharedResource<Texture2D> with the shared handle and creates a KeyedMutex for the resulting texture. Aside from the mutex lock and release each frame, the texture is used just like any other. The overhead in my code seems to be less than 0.5 milliseconds using two Direct3D 10.1 devices. I don't see why it wouldn't work between 10.1 and 11 devices.






