471,325 Members | 1,618 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Managed GUI for DirectX C++ Game Engine?

Hi,

A friend of mine is in the process of building a 3d game engine using
native DirectX in C++. I would like to contribute to the development of
an editor for this engine, but I would prefer to develop it in C#. We've
discussed the possibility of creating a COM-based interface to the
engine that the editor could use from C#, and I think that would work
well for most tasks.

However, I'm not quite sure how I would go about developing a WinForms
GUI that would include the engine as a native DirectX control. Could
anyone offer some advice on this? We would like to keep the low level
details of rendering, culling strategies, scene graph composition, etc.
in the actual engine, and have the editor simply drive the engine with
high level commands. Any thoughts?

Thanks,
John
Dec 22 '05 #1
3 6157
John,

There are two ways I can think of making this happen. The first is to
expose the engine as an ActiveX control, and then add a reference to it in
your project, creating an ActiveX host and interop wrapper.

The second way is to create a managed wrapper, which exposes a managed
interface which you can just use natively in .NET code.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John Hann" <jo******@yahoo.com> wrote in message
news:I8********************@comcast.com...
Hi,

A friend of mine is in the process of building a 3d game engine using
native DirectX in C++. I would like to contribute to the development of an
editor for this engine, but I would prefer to develop it in C#. We've
discussed the possibility of creating a COM-based interface to the engine
that the editor could use from C#, and I think that would work well for
most tasks.

However, I'm not quite sure how I would go about developing a WinForms GUI
that would include the engine as a native DirectX control. Could anyone
offer some advice on this? We would like to keep the low level details of
rendering, culling strategies, scene graph composition, etc. in the actual
engine, and have the editor simply drive the engine with high level
commands. Any thoughts?

Thanks,
John

Dec 24 '05 #2
Nicholas,

Thank you for your input, it definitely helps. With the ActiveX/COM
approach, I think you get everything except the ability to display the
output of the engine in the C# interface. I don't know how a C# app
would host an ActiveX control that is rendering to a native DirectX
Surface. Do you know of any techniques for presenting legacy custom VB
controls (say, an editable dataview) in a C# UI? If there are any, I
would think that the integration points would be similar.

One possibility I've considered is implementing a method in the C# GUI
that the engine could call whenever it completes the rendering of a
frame. This could be implemented in a COM-callable wrapper. If the
engine can render to standard memory buffer, that buffer could be passed
to the GUI for rendering via Managed DirectX. I think this *could* work,
but isn't exactly elegant.

Another approach would be to get the C++ engine to write to directly to
a Managed DirectX device declared in the C# UI. I think that Managed
DirectX is simply a C# abstraction layer that interfaces with the native
APIs. If that is true, one would think that you could get a reference to
the native DirectX device and expose it though COM. Your thoughts?

Nicholas Paldino [.NET/C# MVP] wrote:
John,

There are two ways I can think of making this happen. The first is to
expose the engine as an ActiveX control, and then add a reference to it in
your project, creating an ActiveX host and interop wrapper.

The second way is to create a managed wrapper, which exposes a managed
interface which you can just use natively in .NET code.

Hope this helps.

Dec 24 '05 #3
John,

Actually, you don't need C#/.NET to do anything. Why not just create an
ActiveX control (which has its own rendering surface) which is a layer on
top of your engine? Then, you import this ActiveX control into your
project, and it will just work.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"John Hann" <jo******@yahoo.com> wrote in message
news:tL********************@comcast.com...
Nicholas,

Thank you for your input, it definitely helps. With the ActiveX/COM
approach, I think you get everything except the ability to display the
output of the engine in the C# interface. I don't know how a C# app would
host an ActiveX control that is rendering to a native DirectX Surface. Do
you know of any techniques for presenting legacy custom VB controls (say,
an editable dataview) in a C# UI? If there are any, I would think that the
integration points would be similar.

One possibility I've considered is implementing a method in the C# GUI
that the engine could call whenever it completes the rendering of a frame.
This could be implemented in a COM-callable wrapper. If the engine can
render to standard memory buffer, that buffer could be passed to the GUI
for rendering via Managed DirectX. I think this *could* work, but isn't
exactly elegant.

Another approach would be to get the C++ engine to write to directly to a
Managed DirectX device declared in the C# UI. I think that Managed DirectX
is simply a C# abstraction layer that interfaces with the native APIs. If
that is true, one would think that you could get a reference to the native
DirectX device and expose it though COM. Your thoughts?

Nicholas Paldino [.NET/C# MVP] wrote:
John,

There are two ways I can think of making this happen. The first is
to expose the engine as an ActiveX control, and then add a reference to
it in your project, creating an ActiveX host and interop wrapper.

The second way is to create a managed wrapper, which exposes a
managed interface which you can just use natively in .NET code.

Hope this helps.


Dec 27 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Peter | last post: by
2 posts views Thread by Michael Mayer | last post: by
1 post views Thread by Bleedledeep | last post: by
reply views Thread by wraith | last post: by
12 posts views Thread by Greg | last post: by
3 posts views Thread by Robert Hooker | last post: by
11 posts views Thread by raylopez99 | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.