DisplayPipeline doesn't work

I am trying to render mesh objects in compute.rhino3d with WinForms. I created a headless rhino doc and added a viewport, DisplayModes and some geometry objects. I enabled conduit and set DisplayPipeline events. I also called doc.Views.EnableRedraw and doc.Views.Redraw. However there isn’t any DisplayPipeline event to be triggered.

When I added ViewportControl to my WinForms, most of DisplayPipeline and conduit events were triggered. I compared the properties of both doc objects. They are the same.

There isn’t documents and source code about RhinoWindows.Forms.Controls.ViewportControl. I don’t know what the additional settings are in ViewportControl to make DisplayPipeline work.

Thanks

image

Could anyone give me some suggestions or hints?
Thanks

:slightly_smiling_face:

The best person to explain ViewportControl is @stevebaer .

@nathanletwory Thanks :+1:

There are example projects for Rhino.Inside on GitHub, maybe it is useful

@menno Thanks.
I had tried those samples. That is why I found ViewportControl can trigger DisplayPipeline events. I have to remotely control views. ViewportControl is not suitable to me. However the mechanism of ViewportControl may have the answer I’d like to find.

I see. Do I understand correctly that you want to render mesh objects without a user interface showing the result in a ViewportControl, that is, in an automated way?

@menno

I want to render mesh objects without a user interface in Rhino Compute Server. Then compute sever responds the rendered image.

I’m confused, you don’t want user interface but you are using a ViewportControl. Can you give some details on just what you are trying to accomplish? Thanks

@stevebaer

We bought 30 license keys of Rhino 6 for NURBS and 3D modeling and used those data for deep learning training three years ago. We had Rhino algorithms in C++ and deep learning algorithms in Python. We tried to integrate two kinds of algorithms and then we failed. We used GLFW and OpenGL instead of Rhino 6 and succeeded in the project. To develop algorithms is our goal, not toolchains. We found Rhino Compute Server in July 2021. We’d like to use Rhino Compute Server and grasshopper instead of our toolchain. I implemented a grasshopper plugin with OpenTK, System.Windows.Forms and WindowsMethods.RhTexture2dToBitmap. My deep learning program sent a gh file with NURBS and lights parameters to compute.geometry server and sever returned a rendered image. I indeed need a function similar to ViewportControl to capture the rendered image. Whatever I configured, Rhino.Display.RhinoView class without ViewportControl, DisplayPipeline and conduit events didn’t be triggered. While I added ViewportControl to my WinForm class, most of DisplayPipeline and conduit events were triggered. Why? What is the difference between with ViewportControl and without ViewportControl ? Is it OpenGL context? I will get null if I call wglGetProcAddress without OpenTK. I don’t know when Rhino setup OpenGL context. ViewportControl seems to setup OpenGL context. That is why I want to know the mechanism of ViewportControl. Thanks

I think I understand. Unfortunately, Rhino.Compute does not currently support any sort of view capture mechanism and a ViewportControl is not going to help. We do think we will be able to support view capture at some point in the future, but it will require a number of changes to Rhino’s display architecture.

@stevebaer

Thanks. We wish Rhino.Compute will support view capture.
I think the characteristics of grasshopper are similar to NI LabVIEW. If Rhino and grasshopper could support remote control APIs, we will have more manufacturing applications with Rhino. Happy New Year 2022.