Jump to content
  • Advertisement
Sign in to follow this  
dave

Using XNA (or maybe SlimDX) In An Application That Uses D3D9?

This topic is 3247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My scene editor is written in C# and iterfaces with my Direct3D9 renderer via a C++/CLI. The renderer is written in C++. I want to blag this manipulator for my editor but i have some concerns. I tried to integrate it in but it required alot of XNA stuff that i wasn't in-the-know about. It seems to be revolved around an XNA game application, which my editor isn't and nor should it really be. If you could scan the code at the link above to get an idea for what is required and then answer my questions it would be much appreciated. So: 1) Can i initialise XNAs GraphicsDevice and all required services etc without the XNA Game stuff? 2) Same as above, but can i do it when i already have Direct3D initialised? 3) Is SlimDX an option here in regards to the questions above? If i can't do any of this using XNA or SlimDX then my only other alternative is to have the manipulator do all it's drawing via my renderer. But this gets a little more tricky when i start looking at the picking of the manipulator handles etc. Thanks,

Share this post


Link to post
Share on other sites
Advertisement
All SlimDX objects have a FromPointer method that can be passed an IntPtr representing the unmanaged interface that you've already created, so if you happen to need an interface or two from SlimDX and already have D3D initialized, you can have SlimDX wrap your already created objects using that method.

Share this post


Link to post
Share on other sites
As far as XNA, you can create a GraphicsDevice just by creating anew GraphicsDevice instance. However you can't can't create one from an existing IDirect3DDevice9 COM pointer...XNA isn't designed for that sort of interop (it creates all COM pointers internally and completely "owns" them). SlimDX however can do this, as Mike points out.

Share this post


Link to post
Share on other sites
Thanks alot guys. I think the first thing i will try is getting the manipulator implementation i linked to work straight out of the box. If that fails i'll go for SlimDx.

Cheers,

Share this post


Link to post
Share on other sites
It sounds like neither of these solutions are the way to go for this specific problem. Although i have gotten the SlimDX route kinda working, i would need to have the SlimDX manipulator drawing being done on another thread to the UI and if it shared the engine device it sounds like a recipe for disaster in terms of drawing outside of begin and end scene etc.

The other option is to use my renderer to draw the manipulator shapes. If i use SlimDX to create a fresh device, i need to somehow overlay it on the scene PictureBox component. I tried this but i got a black rectangle where the second rendertarget was positioned, despite clearing it to transparent. If i get it to draw to the same picturebox then whenever the manipulator is drawn (in this case a red triangle) it completely overwrites the render target resulting in a red triangle on a black bacground.

Any recommendations?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!