How to use original OpenGL in VTK program?

I am new to vtk, can you tell me how to use vtk and opengl in the one window (such as QVTKOpenGLWindow)?
For examle, there is a cube painted by vtk, how to add a triangle by opengl in same window?
Thanks.

Some things have been rendered in the QOpenGLWindow through opengl, how to add more through vtk to render, vtkExternalOpenGLRenderWindow?

Hello, friend,

Please, take a look at this: https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/RenderPassExistingContext But its approach is the opposite: you create a standalone OpenGL window and then pass its OpenGL context to VTK to use for rendering.

regards,

Paulo

Hi, the link redirects to the examples page instead of the specific example you mentioned, could please share it again or post the code of the example here?

Unfortunately they took down the page without providing a replacement. At least I could not readily locate the example. Maybe it was renamed. Sorry.

I found it on Wayback Machine web archiving service: VTK/Examples/Cxx/Visualization/RenderPassExistingContext - KitwarePublic

I recommend saving the HTML of the page or having it re-uploaded to the new VTK examples site. Wayback Machine has been around for many years, but who knows how long it will remain available.

That’s great, thank you very much! So if I understand correctly, in this example I render my volume in VTK and pass it to an OpenGL context for visualisation?

You’re welcome. It’s more like: you create a standalone OpenGL window and then pass its OpenGL context to VTK to use for rendering.