Closed rajkundu closed 1 year ago
Seems that the culprit was some misordered #endif
statements in imgui_impl_vtk.cpp
on lines 241-255:
#if VTK_MAJOR_VERSION >= 9
#if VTK_BUILD_VERSION >= 2
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, g_FBOHdl); // required since we set BlitToCurrent = On.
#endif // VTK_BUILD_VERSION >= 2
#else
glBindFramebuffer(GL_FRAMEBUFFER, g_FBOHdl);
#endif // VTK_MAJOR_VERSION >= 9
g_RenderWindow->Render();
#if VTK_MAJOR_VERSION >= 9
#if VTK_BUILD_VERSION >= 2
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#endif // VTK_BUILD_VERSION >= 2
#else
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif // VTK_MAJOR_VERSION >= 9
The #endif
statements belong AFTER the #else
statements, not before them. It should instead look like this (indentation added for clarity):
#if VTK_MAJOR_VERSION >= 9
#if VTK_BUILD_VERSION >= 2
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, g_FBOHdl); // required since we set BlitToCurrent = On.
#else
glBindFramebuffer(GL_FRAMEBUFFER, g_FBOHdl);
#endif // VTK_BUILD_VERSION >= 2
#endif // VTK_MAJOR_VERSION >= 9
g_RenderWindow->Render();
#if VTK_MAJOR_VERSION >= 9
#if VTK_BUILD_VERSION >= 2
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
#else
glBindFramebuffer(GL_FRAMEBUFFER, 0);
#endif // VTK_BUILD_VERSION >= 2
#endif // VTK_MAJOR_VERSION >= 9
Just to be clear, this was not a mere syntax change, but I altered the logic of the code.
Could someone quickly double-check this? (Perhaps @MorcilloSanz, if you have any time?) While my changes worked for my computer running VTK 9.1, I am not sure what the original intended logic was for this section of code.
Edit: I just realized that the code is checking VTK_BUILD_VERSION
- not VTK_MINOR_VERSION
. So it makes even less sense to me than before. I would imagine this is a typo or bug. Unfortunately, I am not too familiar with VTK or the history of its API, or else I would try to fix the issue myself.
Hello! I'm trying to use imgui-vtk for a project of mine, and I'm currently building on macOS 12.5 Monterey using Apple Clang 14.0.0 (for x86-64). I have VTK v9.1.0 from Homebrew. When I try to build and run the example in this repo, I get a blue screen rendered into the ImGui/VTK Window rather than the expected scene. Any idea why this might be?
Here is my
CMakeLists.txt
. The only change vs. this repo is that I cloned glfw source into./glfw
.Here is my CMake build output: