Rendering/interaction issues with VTK 8.2 (Java) + JOGL on Windows

I don’t have any specific and right now, I don’t have access to the old mac mini that was used to build the binaries. But I’ll do my best to help out.

Thanks,

Seb

Hi all.
I have encountered another issue with my vtkJoglCanvasComponent-derived panel.

Basically, in my application I use a “panel docking framework” which allows user to interactively drag and drop/dock panels to other locations in my window (JFrame).
While my vtkJoglCanvasComponent-derived panel cannot be dragged/redocked on its own, its container panel (also containing other children JPanels, in addition to my vtkJoglCanvasComponent-derived panel) can. While dragging/redocking the parent container panel, a “remove()” and then later “add()” calls are triggered on the container itself.

It looks like my vtkJoglCanvasComponent-derived panel reacts to the remove() calls (on the parent container) by destroying itself (glEventListener.dispose() is invoked). When add() is then invoked on the container, glEventListener.init() is invoked again, but it looks like this is not enough to restore functionality of my vtkJoglCanvasComponent-derived panel. In fact, dragging/redocking completely corrupts the functionality of my vtkJoglCanvasComponent-derived panel, which is unable to paint itself after this dragging/redocking operation.

I have already tried setting a different glEventListener, which doesn’t call Delete() in the dispose() method, but this is not enough to make it work.

Do you have suggestions about how I could fix this issue?

Thanks and best regards,

Marco Sambin

I’m confused by this. Where is viewInited set to true? Where is initializeView() called from? Is it called repeatedly?

You haven’t shown enough code to draw any meaningful conclusions.

Saving and loading the OpenGL state might be the cause of the jerky refresh rate.

void vtkGenericOpenGLRenderWindow::Render()
{
  if (this->ReadyForRendering)
  {
    this->MakeCurrent();
    if (!this->IsCurrent())
    {
      vtkLogF(TRACE, "rendering skipped since `MakeCurrent` was not successful.");
    }
    else
    {
      // Query current GL state and store them
      this->SaveGLState();

      this->Superclass::Render();

      // Restore state to previous known value
      this->RestoreGLState();
    }
  }
}

particularly the release of the current shader

void vtkOpenGLRenderWindow::RestoreGLState()
{
  // Prevent making GL calls unless we have a valid context
  if (this->Initialized)
  {
    // For now just re-store the texture unit
    this->GetState()->vtkglActiveTexture(GL_TEXTURE0 + this->GLStateIntegers["GL_ACTIVE_TEXTURE"]);

    // Unuse active shader program
    this->GetShaderCache()->ReleaseCurrentShader();
  }
}

Hello Todd,

first of all, let me clarify that the slow/jerky refresh rate issue is mainly solved, as explained in my latest posts above.

However, in order to answer your questions, my initializeView() method is called on the EDT while initializing/building my GUI. It is called only once, and the viewInited variable is set to true at the end of the initializeView() method itself, sorry for omitting this portion.
As explained in my posts above, please consider that a single interactor.EnableRenderOn() call (for instance, made during component initialization) is sufficient in order to cause the jerky refresh rate. It looks like JOGL components are not designed to work with interactor’s rendering set to ON.

Now my latest issue is different, and it is related to .remove() / .add() calls on the parent container, which cause the JOGL-based panel to stop working correctly.

I will try to assemble a self-contained test case, and hopefully come back soon.

Thanks for all your feedback and best regards,

Marco Sambin

Hello everybody.
I’ve finally come up with a simple example which shall demonstrate the issue that I am currently experiencing with my vtkJoglCanvasComponent-derived panel and the panel docking framework I am using in my Java application.
The example is based on the JoglConeRendering example, with a slight modification which adds a JButton which shall remove and then re-add the vtkJoglCanvasComponent to its container. The code is attached.

JoglConeRenderingPanelMove.java (7.5 KB)

After I press the JButton, the JOGL-based panel is completely corrupted, it becomes entirely empty (black) and the cone cannot be rendered any longer in the panel. Eventually, the application even crashes.

I am testing with VTK 8.2 + JOGAMP v2.3.2 + Java v1.8.0_151 on Windows 10 (64-bit).

Any suggestion about how to fix the situation when my JOGL panel is removed and then re-added to the container will be greatly appreciated.

Thanks and best regards,

Marco Sambin

Hello everybody.

Has anyone been able to run this test case, and confirm at least if this issue can be reproduced at your side?
I would greatly appreciate.

Thanks and best regards,

Marco Sambin

Hello Marco.
I tested your code. Yes the panel is not showing anything, after pressing the button. It did not crash.
Only difference: I am using Java 8u202.

Best,
Tom

Hello Tom,

thanks a lot for your feedback, really appreciated.

Now that I know that the issue is reproducible, I would really appreciate if someone could provide suggestions about how to fix it.

Thanks in advance.
Best regards,

Marco

Hi everybody,

I am having the same issue when running the test of @Marco
JoglConeRenderingPanelMove.java on Java 14 & VTK-9.1.0

Is there any solution/workaround to this problem?
Thanks in advance,
Regards,
/ Minh