Announcement

Collapse
No announcement yet.

How to, if it's possible, render a c++ application 3D scene graph into a C# form view

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to, if it's possible, render a c++ application 3D scene graph into a C# form view

    Dear Mike,
    Dear All,

    Please i like to know if there is a way to render a c++ application 3D scene graph into a C# form view;
    I'll try to explain my question:

    i have my OIV based c++ mfc project: it has its own 3D view and i'd like to "replicate" in some way, that 3D view in another C# viewer built;

    of course i was thinking to create a c++ DLL (or another plugin to load into C# project) managing the only scene graph and the C# application can "host" the rendering giving the openGL context to the DLL scene graph.

    Please, can You suggest other ways (if possible) in order to have this openGL context sharing?

    Many thanks in advance.
    Regards,

    Vincenzo

  • #2
    Originally posted by [email protected] View Post
    Dear Mike,
    i have my OIV based c++ mfc project: it has its own 3D view and i'd like to "replicate" in some way, that 3D view in another C# viewer built;
    of course i was thinking to create a c++ DLL (or another plugin to load into C# project) managing the only scene graph and the C# application can "host" the rendering giving the openGL context to the DLL scene graph.
    Hi Vincenzo,
    If I understand correctly, you want to create a viewer application in C# and use your existing C++ code (in the new application) to create the scene graph.
    I think you are on the path. Here are some key points that may be useful.
    • We provide a C# API for Open Inventor (you probably know that),
      So it is easy to write a 3D viewer application using either the viewer classes or the viewer component classes.
      If you are using OIV 9.9.10 or later, your OIV license string unlocks both C++ and C#.
      If you are using an older version, we can provide a license string (through your sales rep).
    • The Open Inventor C# API is a "wrapper" around the C++ implementation.
      So, creating an OIV node in C# creates both a C# object and a C++ object.
      Conversely it is possible to create a node in C++, then create the C# wrapper object.
    • We provide some helper methods to assist with embedding OIV C++ code in a C# application.
      Specifically, if your proposed DLL creates a scene graph in C++ and returns the 'root' node,
      then you can write (in C#):
      SoGroup sceneRoot = SoNetBase.GetInstance<SoGroup>(sceneRootFromCpp);
      Then pass 'sceneRoot' to your C# viewer's SetSceneGraph() method.
    Regards,
    Mike

    Comment


    • #3
      Dear Mike,
      First of all, thank You very much for Your fast reply and Your help and suggestions;

      Your suggested points are very useful to me, and as first way i'll try to follow them.

      Please, can i put another question?

      I know that C# OIV API are very powerful and useful, but if i had a C# Form view (for example) not using OIV libraries and my DLL (using OIV libraries of course)
      can i pass the form view handle (HWND) to my dll member object in order to render scene graph directly into form view?

      Is it possible this way or it's too hard or unstable?

      I hope my last question was well and clear explained; if not please don't hesitate to ask further informations.

      Thank You very much again for Your kindness and help.

      Regards,

      Vincenzo

      Comment


      • #4
        Originally posted by [email protected] View Post
        I know that C# OIV API are very powerful and useful, but if i had a C# Form view (for example) not using OIV libraries and my DLL (using OIV libraries of course)
        can i pass the form view handle (HWND) to my dll member object in order to render scene graph directly into form view?
        Hi Vincenzo,
        OK, I see what you mean now! I have not tried that specific scenario, but I think it should work.
        The Open Inventor C++ viewer classes for Windows were designed to allow a viewer to be created inside any HWND. It shouldn't matter how the HWND was created. So you should be able to create a Form view in C#, pass the HWND to the C++ DLL and create the viewer object in C++. Then the C++ code can build and set the scene graph as usual.
        Regards,
        Mike

        Comment


        • #5
          Dear Mike,
          thank You very much...i very appreciate Your help!
          Have a nice day!

          Regards,
          Vincenzo

          Comment

          Working...
          X