QuickVtk icon indicating copy to clipboard operation
QuickVtk copied to clipboard

Is it possible to use Vtk9.0.0

Open crocketyang opened this issue 5 years ago • 10 comments

Is it possible to use Vtk9.0.0, since I know Vtk9.0.0 fixed many issues.

crocketyang avatar Jun 16 '20 02:06 crocketyang

Did't compile with vtk9.0.0. I just compiled it with vtk from master, after fixing some small issues there is one left I don't know how to do at quickVtkFboOffscreenWindow.cpp:

auto FboOffscreenWindow::SetFramebufferObject(QOpenGLFramebufferObject *fbo) -> void {
    this->BackLeftBuffer = this->FrontLeftBuffer = this->BackBuffer = this->FrontBuffer = static_cast<unsigned int>(GL_COLOR_ATTACHMENT0);

    auto size                    = fbo->size();

    this->Size[0]                   = size.width();
    this->Size[1]                   = size.height();
    this->NumberOfFrameBuffers      = 1;
    this->FrameBufferObject         = static_cast<unsigned int>(fbo->handle());
    this->DepthRenderBufferObject   = 0;
    this->TextureObjects[0]         = static_cast<unsigned int>(fbo->texture());
    this->OffScreenRendering        = 1;
    this->OffScreenUseFrameBuffer   = 1;
    this->Modified();
}

So, from this commit some real changes must be made to compile with the latest vtk.

maidamai0 avatar Jun 25 '20 13:06 maidamai0

According to this issue on gitlab vtk it seems still possible to to this.But I don't know how.

maidamai0 avatar Jun 25 '20 22:06 maidamai0

Any solution yet? I'm facing the same problem.

danielbuhrig avatar Sep 23 '20 20:09 danielbuhrig

Hey @danielbuhrig, I'm working on refactoring the project and set things up for VTK 9.0 but that will take some time. I'll keep this issue updated as development goes on

qCring avatar Sep 24 '20 11:09 qCring

Cool, thank you!

On Thu, Sep 24, 2020 at 1:21 PM A. E. Szalo [email protected] wrote:

Hey @danielbuhrig https://github.com/danielbuhrig, I'm working on refactoring the project and set things up for VTK 9.0 but that will take some time. I'll keep this issue updated as development goes on

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/qCring/QuickVtk/issues/56#issuecomment-698282000, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4IVZU2G2FCEIUXDWE4IW3SHMTVNANCNFSM4N7FRO2A .

danielbuhrig avatar Sep 24 '20 11:09 danielbuhrig

@qCring Did you make any progress here? I'm also at looking integrating using the QQuickFrameBuffer interface. From your code, I believe the SetFrameBufferObject function needs to become something like the following:

    auto FboOffscreenWindow::SetFramebufferObject(QOpenGLFramebufferObject* fbo) -> void
    {
        vtkTextureObject* tex = vtkTextureObject::New();
        tex->AssignToExistingTexture(fbo->handle(), fbo->texture());
        this->GetDisplayFramebuffer()->AddColorAttachment(0, tex);
        this->Modified();
    }

After making this change, I'm having some problems with initializing the OpenGL state.

In OpenGLInitState the application is getting an Access Violation in vtkOpenGLState::Initialize() on the following function ::glBlendFuncSeparate(cs.BlendFunc[0], cs.BlendFunc[1], cs.BlendFunc[2], cs.BlendFunc[3]);.

Let me know if you've seen this, maybe we can help each other out.

EDIT: If I call glBlendFuncSeparate directly in OpenGLInitState, it seems to take fine. But the code snippet above probably isn't right. I'm getting lots of gl errors now:

vtkTextureObject.cxx:1751   ERR| vtkTextureObject (000001E44367A6E0): failed at glTexImage2D 1 OpenGL errors detected
  0 : (1280) Invalid enum

I'm just going to roll back to 8.2 for now.

jhuels avatar Nov 10 '20 21:11 jhuels

Hi Jhuels

The initialization you get is most likely due to Qt initializing the context using the message loop.

I had similar issues with this before and polled the application - process events until the window is valid. If not all glXXX calls will segfault.

We are still stuck with 8.2 for other reasons, but I will soon move to 9.0

/Jens

On Tue, 10 Nov 2020, 22:12 jhuels, [email protected] wrote:

@qCring https://github.com/qCring Did you make any progress here? I'm also at looking integrating using the QQuickFrameBuffer interface. From your code, I believe the SetFrameBufferObject function needs to become something like the following:

auto FboOffscreenWindow::SetFramebufferObject(QOpenGLFramebufferObject* fbo) -> void
{
    vtkTextureObject* tex = vtkTextureObject::New();
    tex->AssignToExistingTexture(fbo->handle(), fbo->texture());
    this->GetDisplayFramebuffer()->AddColorAttachment(0, tex);
    this->Modified();
}

After making this change, I'm having some problems with initializing the OpenGL state.

In OpenGLInitState the application is getting an Access Violation in vtkOpenGLState::Initialize() on the following function ::glBlendFuncSeparate(cs.BlendFunc[0], cs.BlendFunc[1], cs.BlendFunc[2], cs.BlendFunc[3]);.

Let me know if you've seen this, maybe we can help each other out.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qCring/QuickVtk/issues/56#issuecomment-724969089, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQJKYXPDVEY6NCAZ5S45I3SPGUCJANCNFSM4N7FRO2A .

JensMunkHansen avatar Nov 11 '20 00:11 JensMunkHansen

Thanks for the hint Jens!

I found out it was due to GLEW not being initialized before setting up the context state. This can be solved by calling vtkOpenGLRenderWindow::OpenGLInitContext() before initializing the vtkOpenGLState.

jhuels avatar Nov 11 '20 20:11 jhuels

@jhuels Did you means that you have success to migrate to VTK 9.0?

behtgod avatar Dec 08 '20 02:12 behtgod

No, I just used 8.2 cause it worked. I had the same issue on both versions, so presumably you could get 9.0 working as well.

jhuels avatar Dec 08 '20 06:12 jhuels