Open pwm1234-sri opened 3 years ago
It should work on current master
Hello! I made some different using the imgui-vtk. Also, I have same problems. In my case, I got a nullpointException in SetupDemoPipeline(). [line no 106]
Hello! I made some different using the imgui-vtk. Also, I have same problems. In my case, I got a nullpointException in SetupDemoPipeline(). [line no 106]
I solved it. It occurred vtk files[using the cmake]. (vtk version latest version 9.2)
I'm faced with another problem as below. As you can see, it does not appear on the screen. So, I tried to vtk sample code on the vtk homepage.
==============================
static vtkSmartPointer
// Set the background color.
std::array<unsigned char, 4> bkg{ {26, 51, 102, 255} };
colors->SetColor("BkgColor", bkg.data());
// This creates a polygonal cylinder model with eight circumferential facets
// (i.e, in practice an octagonal prism).
auto cylinder = vtkSmartPointer<vtkCylinderSource>::New();
cylinder->SetResolution(8);
// The mapper is responsible for pushing the geometry into the graphics
// library. It may also do color mapping, if scalars or other attributes are
// defined.
auto cylinderMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
cylinderMapper->SetInputConnection(cylinder->GetOutputPort());
// The actor is a grouping mechanism: besides the geometry (mapper), it
// also has a property, transformation matrix, and/or texture map.
// Here we set its color and rotate it around the X and Y axes.
auto cylinderActor = vtkSmartPointer<vtkActor>::New();
cylinderActor->SetMapper(cylinderMapper);
//cylinderActor->GetProperty()->SetColor(colors->GetColor4d("Tomato").GetData());
cylinderActor->RotateX(30.0);
cylinderActor->RotateY(-45.0);
return cylinderActor;
What system are you using? I can't seem to replicate your issue on my 16" Intel MacBook Pro (macOS 12.5), as the cylinder works fine for me:
I encountered the same issue while running the demo. The viewer area does not display anything, and the button to adjust the background color does not respond. I am using Windows+vcpkg+vtk9.3. I am a beginner in VTK, is it due to platform differences?
Thanks for this excellent example using vtk with imgui+glfw. Unfortunately, I am a novice at both, and I am having problems adapting it to use a
`vtkImageActor
. In the snippet below, the reader and actor code (up to the dynamic_cast) came from the vtk example ImageReader2Factory. But when I use the actor returned by my SetupImagePipeline() instead of your SetupDemoPipeline(), I do not get the image shown in the imgui window. (I am able to run the standalone vtk example, so my vtk+glfw environment is working.)Is there something special that is needed to make your example work with a vtkImageActor? I appreciate any help, and, of course, I will be glad to provide you a PR if I able to get this to work. (By the way, I am doing this on windows with a vcpkg build of imgui and vtk.)
(Note: in the snippet above I have a hack where the initial actor is static. I do this because I am trying to focus on the main problem where the image actor is not showing the image in the imgui window. This is here to avoid the secondary problem to correct my ignorance of how to work with both vtkNew and vtkSmartPointer. I thought a vtkSmartPointer would automatcally convert to a vtkSmartPointer but that does not seem to compile. So the last two lines in the snippet are a hack to make the compiler happy and avoid crashing when the inital actor goes out of scope. I will fix that if/when I am able to get the vtkImageActor to work.)