upgrade engineering ui for c#

Started by
8 comments, last by shadowisadog 8 years, 8 months ago

hello.
I must create a graphical interface ui for a 3d engine and engineering written in c++.
For now the program uses opengl and is written in c++ mfc, yes , the interface is ugly.
I ask to you if is better create a wrapper for each dialogs and exporting all the functions that use the dialog with c++ cli then use it in c#
there is a common pattern for this?
2) next i must export the opengl scene in c# how i can do this?

thanks.

by

Advertisement

You could create a managed C++ wrapper and use that in the c#

Usually, in engineering software, the internal data representation (the engineering data) is not stored in a format optimized for rendering, but rather it is converted to graphics primitives just before rendering. For example, there is no convenient or practical way to directly represent arbitrary parametric solids in OpenGL or DirectX, and yet many common engineering software (Inventor, Pro/Engineer, Solidworks etc.) does let the user manipulate parametric solids as primary mode of operation.

The graphical representation is usually generated by trimming the boundaries of the engineering primitives (be it 2D or 3D), and tessellating the visible boundaries to polylines or triangle meshes. Probably needless to say, but this step is very much easier said than done biggrin.png

Niko Suni

Usually, in engineering software, the internal data representation (the engineering data) is not stored in a format optimized for rendering, but rather it is converted to graphics primitives just before rendering. For example, there is no convenient or practical way to directly represent arbitrary parametric solids in OpenGL or DirectX, and yet many common engineering software (Inventor, Pro/Engineer, Solidworks etc.) does let the user manipulate parametric solids as primary mode of operation.

The graphical representation is usually generated by trimming the boundaries of the engineering primitives (be it 2D or 3D), and tessellating the visible boundaries to polylines or triangle meshes. Probably needless to say, but this step is very much easier said than done biggrin.png

very thanks , but what is the gain in this system.
It is a frame rate gain ?
or what , sorry but i not understand.
I have to show a scene with a build architectonic and the user can select / deselect or get information from opened dialog when select or click on a part of this scene for simplify.
In the program in c++ opengl work fine like the bounding volume for select deselect and other hundred functions that modify the scene from dialog in c#
thanks

sorry for my english

bysmile.png

ps , in opengl how i can set a c++ 3d scene on a c# panel or form ?

I assume that the "parts" you talk about are walls, bars, doors, windows, roof elements etc.?

A graphics API has no concept of such objects. Yet, the engineer will want to manipulate objects at such logical level.

Therefore, the internal representation should match the level in which the user wants to manipulate the data, not the level in which a graphics API wants the data in order to draw it.

The abstraction and conversion does not gain any frame rate - in fact, it is slower than just drawing a list of triangles. However, a practical engineer will not use a program that forces him/her to manipulate raw drawing primitives in order to make design changes. Sure, AutoCAD (for example) does allow you to touch individual primitive lines, but this is not how an building architect primarily would use the software.

Engineering software is considerably different from freeform mesh modelers (such as Blender, Maya or 3DS Max), wherein the main mode of operation is to manipulate primitive meshes. But even in those programs, the internal representation of the mesh is much more complex than that which gets sent to the graphics API, mainly to enable complex modeling operations, texture mapping and remapping, and complex selection logic.

Niko Suni

I assume that the "parts" you talk about are walls, bars, doors, windows, roof elements etc.?

A graphics API has no concept of such objects. Yet, the engineer will want to manipulate objects at such logical level.

Therefore, the internal representation should match the level in which the user wants to manipulate the data, not the level in which a graphics API wants the data in order to draw it.

The abstraction and conversion does not gain any frame rate - in fact, it is slower than just drawing a list of triangles. However, a practical engineer will not use a program that forces him/her to manipulate raw drawing primitives in order to make design changes. Sure, AutoCAD (for example) does allow you to touch individual primitive lines, but this is not how an building architect primarily would use the software.

Engineering software is considerably different from freeform mesh modelers (such as Blender, Maya or 3DS Max), wherein the main mode of operation is to manipulate primitive meshes. But even in those programs, the internal representation of the mesh is much more complex than that which gets sent to the graphics API, mainly to enable complex modeling operations, texture mapping and remapping, and complex selection logic.

no, i I not explained well.
The c++ program have hight level many functions and these functions modify the scene in c++ and do other stuff.I think to create a wrapper for every mfc dialog and call these function that automatically modify the scene from c#.
Then only present the scene.
But if the opengl window have an handler to the c# panel ....

I use c# only for create nice graphical interface ui then i call the c++ function from the c# dialog and this function modifies the scene if the scene must be modified and do other engineering.
We don't write functions in c# all is written in c++ for performance gain and because these functions are already made

I work from 6 years in c++ and i would use some wrappers and api around the project , i'm not interested to your solution, i would create a scene in c++ and show it in c# in a panel or something like.
There is a tutorial or already made with c++ c# code?
I read that the cli c++ is perfect for create wrapper around c++ that comunicate with c# as a simple dll.
Thanks and sorry if i don't use your solution but i wish do a different project from your case.

by

I misunderstood your needs.

Basic interoperation between Windows Forms and native window handles is extremely easy, as is with WPF and native. I recommend creating a small proof of concept project, in which you'd communicate between the two frameworks (native+forms or native+wpf) you want to use. Then you would be ready to apply the gained experience to a complex project like your engineering application.

The difficulty in such interoperation arises when you want to use ActiveX (which is a COM framework on top of native) style properties - such as control colors - seamlessly with the newer frameworks. Not all properties are communicated, or even relevant anymore.

Niko Suni

I misunderstood your needs.

Basic interoperation between Windows Forms and native window handles is extremely easy, as is with WPF and native. I recommend creating a small proof of concept project, in which you'd communicate between the two frameworks (native+forms or native+wpf) you want to use. Then you would be ready to apply the gained experience to a complex project like your engineering application.

The difficulty in such interoperation arises when you want to use ActiveX (which is a COM framework on top of native) style properties - such as control colors - seamlessly with the newer frameworks. Not all properties are communicated, or even relevant anymore.

very thanks, realy

I might suggest a different approach than going C# if the 3D engine is written in C++. Qt is a powerful, cross platform GUI toolkit that I find works very nicely. It would probably be less work to create a GUI for your needs in it and you would not need to do the marshaling back and forth between C++ and C#.

This topic is closed to new replies.

Advertisement