|
1 |
| - |
2 |
| -# VTK Widget for DearImGUI |
3 |
| - |
4 |
| -* An effort to incorporate VTK's dataset visualization capabilities with versatility of DearImGUI |
5 |
| -* Renders VTK content into a viewport within an ImGui Window |
6 |
| -* Look in `main.cpp` for details on example usage |
7 |
| - |
8 |
| -## Changes vs. [trlsmax/imgui-vtk](https://github.com/trlsmax/imgui-vtk) |
9 |
| -- `imgui_impl_vtk` files are now deprecated in favor of using `VtkViewer` objects |
10 |
| -- Uses VTK OpenGLRenderWindow's framebuffer directly |
11 |
| -- Fixes/upgrades IO behavior |
12 |
| -- Uses ImGui's `docking` branch (but doesn't depend on it; you can certainly avoid/revert this if desired) |
13 |
| -- Includes `imgui`, `gl3w`, and `glfw` directly as git submodules in this repository |
14 |
| -- Builds components separately in `CMakeLists.txt` and links them as static libraries |
15 |
| - - `CMakeLists-alt.txt` is more similar to the old `CMakeLists.txt`, building everything together from source |
16 |
| -- Supports multiple independent `VtkViewer` instances/windows |
17 |
| -- Usage (see `main.cpp` for details) |
18 |
| - - Previous: ImGui window was created for you |
19 |
| - - Current: You must create (and end) ImGui windows yourself |
20 |
| - - This allows you to place other widgets in same window as VTK "viewport" and control all aspects of the ImGui Window yourself |
21 |
| -- **Note: For the sake of cleanliness and readability, most preprocessor directives were removed.** Files no longer auto-detect your OpenGL loader. While everything is currently set up for OpenGL3 + GLFW + GL3W, you may need to adjust `#include` statements, etc. to match your use case. |
| 1 | +# imgui-vtk |
| 2 | +- Incorporate VTK's dataset visualization capabilities with versatility of Dear ImGui |
| 3 | + - Multiple independent `VtkViewer` instances can be used in the same program to display multiple VTK scenes simultaneously |
| 4 | +- Uses VTK's OpenGLRenderWindow class |
| 5 | + - Renders to texture and displays the texture natively with ImGui |
| 6 | +- Compatible with both ImGui's `main` and `docking` branches |
22 | 7 |
|
23 | 8 | 
|
24 | 9 |
|
|
32 | 17 | - See `CMakeLists-alt.txt` for more details
|
33 | 18 | - See `main.cpp`
|
34 | 19 |
|
35 |
| -``` |
36 |
| -dataset = .. |
37 |
| -filter = .. |
38 |
| -mapper1 = .. |
39 |
| -mapper2 = .. |
40 |
| -actor1 = .. |
41 |
| -actor2 = .. |
42 |
| -filter->SetInputData(dataset); |
43 |
| -
|
44 |
| -mapper1->SetInputConnection(filter->GetOutputPort(0)); |
45 |
| -mapper2->SetInputConnection(filter->GetOutputPort(1)); |
46 |
| -... |
47 |
| -
|
48 |
| -actor1->SetMapper(mapper1); |
49 |
| -actor2->SetMapper(mapper2); |
50 |
| -... |
51 |
| -
|
52 |
| -ImguiInit... |
53 |
| -
|
54 |
| -VtkViewer myVtkViewer; // create VTKViewer object |
55 |
| -myVtkViewer.addActor(myActor); // give it an actor |
56 |
| -
|
57 |
| -while (!terminate) |
58 |
| -{ |
59 |
| - Imgui new frame.. |
60 |
| - custom imgui windows.. |
61 |
| -
|
62 |
| - // VTK Viewer Window |
63 |
| - ImGui::Begin("My VTK Viewer"); |
64 |
| - myVtkViewer.render(); // render VtkViewer within window |
65 |
| - ImGui::End(); |
66 |
| -
|
67 |
| - ImGui::Render(); |
68 |
| - ImGui_Impl_xxx_RenderDrawData(); |
69 |
| -} |
70 |
| -``` |
| 20 | +## Notes |
| 21 | +- `imgui`, `gl3w`, and `glfw` are included in this repository as git submodules |
| 22 | + - For integration into an existing project, only `VtkViewer.h` and `VtkViewer.cpp` are needed. However, they will need to be linked with or built alongside Dear ImGui and VTK |
| 23 | +- Dependencies are built separately in `CMakeLists.txt` then linked together as static libraries |
| 24 | + - `CMakeLists-alt.txt` builds everything together from source |
| 25 | +- Usage (see [`main.cpp`](main.cpp) for details) |
| 26 | + - You must create and end ImGui windows yourself |
| 27 | + - Allows for other widgets to be placed in the same ImGui window as the VTK "viewport" |
| 28 | + - Allows for full control over window size, behavior, etc. via Dear ImGui API |
| 29 | +- **Note: For the sake of cleanliness and readability, most ImGui preprocessor directives were removed.** Files no longer auto-detect your OpenGL loader. While everything is currently set up for OpenGL3 + GLFW + GL3W, you may need to adjust `#include` statements, etc. to match your use case. |
0 commit comments