Showing a VTK view as a wxPanel

257 views
Skip to first unread message

Alex Bettarini

unread,
Sep 22, 2023, 7:41:45 AM9/22/23
to wx-users
I have already posted this in the wXWidgets forums, but I am restating it here for correctedness.

I need to add 3D functionality to my project by using VTK in a wxWidgets GUI with all the usual buttons and controls.
These are my requirements:

1. embed VTK as a wxPanel, or wxFrame, or wxGLCanvas subclass, or anything that achieves the same result
2. C++ project using CMake on macOS Windows and Linux
3. after drawing the VTK panel I need to overlay graphics elements drawn with OpenGL (Core profile). Luckily VTK is also using OpenGL, so I need to reuse the same graphics context, but using my own OpenGL shaders.

What I have done so far:
- I am using wxWidgets 3.2.2.1 and VTK 9.3.0.rc1
- I have already created a first Hello World project based on
https://github.com/harshn05/wxvtk-UpdatedOnJan23_2018
On macOS I needed to make some minor edits to build successfully but when I run it nothing appears in the VTK area.

Can anybody please help with a basic, up-to-date, tested (possibly macOS first) example to get me started ?

Andrew Trevorrow

unread,
Sep 22, 2023, 6:47:33 PM9/22/23
to wx-u...@googlegroups.com
You might want to look at Ready, a wxWidgets app that uses VTK:


In particular, see wxVTKRenderWindowInteractor.* in src/gui.

Hope that helps,
Andrew

--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/1b52314c-c4d9-4f29-ad87-c2967d170958n%40googlegroups.com.

Alex Bettarini

unread,
Sep 23, 2023, 9:45:27 AM9/23/23
to wx-users
Thank you. Now it's working after commenting out  a few lines of the code in function `GetHandleHack()` as commented on line 370 "AKT: not needed..."
Reply all
Reply to author
Forward
0 new messages