简体   繁体   中英

Creating native C++ OpenGL 3D editor and using it as a WinForms or WPF control in C#

I want to create a simple 3D editor program, and I don't like C++ windows programming. But I don't want to mess with managed code when using OpenGL, either. So, it is possible to create in native C++ a control which will host the OpenGL 3D drawing surface, with no other controls, and also with an interface (methods and properties), and use it as a control in a WinForms, or even better, WPF application?

It is also possible to use managed C++. I created a simple OpenGL control for WinForms which suits your requirements. You can find more info about it here .

Does it have to be OpenGL? Consider using XNA which would let you use C# and DirectX. Otherwise I suggest you find a C# wrapper for OpenGL. There are two wrappers listed here http://www.opengl.org/resources/bindings/ .

I dont really understand your intention. You said that you hate C++ programming, you dont want to mess with managed code when using OpenGL, you want opengl windows with no ui control but you want winform or wpf as you ui.

If you hate programming c++, you have to use managed code. If you dont want to mess with managed code when using OpenGL, you have to use c++ programming. if you want to create in native C++ a control which will host the OpenGL 3D drawing surface, with no other controls(which i assume UI controls), why consider winform or wpf?

Dont use WPF to create 3d heavy applications. wpf was meant as a ui. you will find a lot of limitation along the way. There is also limitation in hosting(WPF), which makes it useless to use opengl with wpf.

I think the best bet would be XNA or http://www.opentk.com/(if you must use OpenGL). Tao Framework is obsolete and is not worth the effort.

I suggest you look at Ogre 3D ( http://www.ogre3d.org ). This cross-platform C++ library covers Open GL as well as DirectX. It has been successfully embedded in Qt, MFC and even has .NET representation. I highly suggest you take a look at it.

您所要做的就是在c ++中创建一个包装器,在c#中公开函数

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM