[vtkusers] QT VTK OpenGL errors

Ken Martin ken.martin at kitware.com
Tue Nov 1 20:59:55 EDT 2016


What version of VTK are you using? There were some fixes related to that
type of issue a few weeks ago.

Thanks!
Ken

On Tue, Nov 1, 2016 at 8:01 PM, Mike Withascarf via vtkusers <
vtkusers at vtk.org> wrote:

> That's right, the problem only happens if there are more than one
> QVTKWidget.
>
> I've managed to create a fairly simple example to reproduce the problem:
>
> https://drive.google.com/open?id=0BxalkOjn2_PecG5kUUZrN2djMlU
>
> It's a very basic modification of the SideBySideRenderWindowsQt example
> provided by VTK. I've simply added a button, and when it's clicked it will
> clear the left window and add a sphere, then clear the right window and add
> a sphere. If I do the following it produces the OpenGL errors every time
> for me:
>
> 1. Click the button.
> 2. Manually rotate both spheres.
> 3. Click the button.
> 4. Manually rotate both spheres.
> 5. Click the button.
> 6. Manually rotate both spheres. (You'll get the errors here)
>
> Here's the code below. Interestingly if I move both clear calls before
> both of the addsphere calls it works fine. Unfortunately that approach
> won't work for my app (needs to be able to change a single window).
>
>
> #include "SideBySideRenderWindowsQt.h"
>
> void addsphere(vtkSmartPointer<vtkRenderWindow> renwin)
> {
>         vtkSmartPointer<vtkSphereSource> sphereSource =
>                 vtkSmartPointer<vtkSphereSource>::New();
>         sphereSource->SetCenter(0.0, 0.0, 0.0);
>         sphereSource->SetRadius(5.0);
>
>         vtkSmartPointer<vtkPolyDataMapper> mapper =
>                 vtkSmartPointer<vtkPolyDataMapper>::New();
>         mapper->SetInputConnection(sphereSource->GetOutputPort());
>
>         vtkSmartPointer<vtkActor> actor =
>                 vtkSmartPointer<vtkActor>::New();
>         actor->SetMapper(mapper);
>
>         vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::
> New();
>         ren->AddActor(actor);
>         ren->ResetCameraClippingRange();
>
>         renwin->AddRenderer(ren);
>         renwin->Render();
> }
>
> void clear(vtkSmartPointer<vtkRenderWindow> renwin)
> {
>         // clear renderer
>         vtkSmartPointer<vtkRenderer> ren =
>                 renwin->GetRenderers()->GetFirstRenderer();
>         if (ren)
>         {
>                 ren->RemoveAllViewProps();
>                 renwin->Render();
>                 renwin->RemoveRenderer(ren);
>         }
> }
>
> // Constructor
> SideBySideRenderWindowsQt::SideBySideRenderWindowsQt()
> {
>   this->setupUi(this);
>
>   QObject::connect(b1, SIGNAL(released()), this, SLOT(slot_b1()));
>
>   // Set up action signals and slots
>   connect(this->actionExit, SIGNAL(triggered()), this, SLOT(slotExit()));
> }
>
> void SideBySideRenderWindowsQt::slot_b1()
> {
>         clear(this->qvtkWidgetLeft->GetRenderWindow());
>
>         addsphere(this->qvtkWidgetLeft->GetRenderWindow());
>         this->qvtkWidgetLeft->GetRenderWindow()->Render();
>
>         clear(this->qvtkWidgetRight->GetRenderWindow());
>
>         addsphere(this->qvtkWidgetRight->GetRenderWindow());
>         this->qvtkWidgetRight->GetRenderWindow()->Render();
> }
>
> void SideBySideRenderWindowsQt::slotExit()
> {
>   qApp->exit();
> }
>
>
> ------------------------------
> *From:* Thales Luis Rodrigues Sabino <tluisrs at gmail.com>
> *To:* Mike Withascarf <mikewithascarf at yahoo.com>
> *Cc:* "vtkusers at vtk.org" <vtkusers at vtk.org>
> *Sent:* Tuesday, November 1, 2016 7:19 PM
> *Subject:* Re: [vtkusers] QT VTK OpenGL errors
>
> This looks like an OpenGL resource sharing issue. I don't know exactly how
> VTK handles multiples windows in a Qt application but it looks like it is
> trying to bind a texture that is not registered in a certain context.
>
> Can tell if this happens when you have a single window or this happens
> only when you add a second window?
>
> On Tue, Nov 1, 2016 at 8:15 PM, Mike Withascarf via vtkusers <
> vtkusers at vtk.org> wrote:
>
> I'm using QT with VTK for a fairly complex application. Everything works
> fine
> normally, but if I try to use a function to 'clear' the QVTKWidget, and
> then
> add a new pipeline, I run into lots of OpenGL errors. What would be the
> appropriate way to clear the window/renderer? Here is the code I've been
> trying, where window is of type QVTKWidget:
>
> vtkSmartPointer<vtkRenderer> ren_old =
> window->GetRenderWindow()-> GetRenderers()-> GetFirstRenderer();
> if (ren_old) ren_old->RemoveAllViewProps(); // Remove the pipeline from
> renderer
> if (window->isVisible() && window->GetRenderWindow()-> IsDrawable())
> window->GetRenderWindow()-> Render(); // Update the window so it is blank
> if (ren_old) window->GetRenderWindow()-> RemoveRenderer(ren_old); // Remove
> the renderer
>
>
>
> I'm using multiple QVTKWidgets in one app, and each might have a pipeline
> that connects either with vtkImageViewer2 or a normal vtkRenderer. Here are
> the OpenGL errors reported in the vtkOutputWindow:
>
> ERROR: In C:\vtk\src\Rendering\OpenGL2\ vtkTextureObject.cxx, line 540
> vtkTextureObject (0000029AC7337C70): failed at glBindTexture 1 OpenGL
> errors
> detected
>   0 : (1282) Invalid operation
>
>
> ERROR: In C:\vtk\src\Rendering\OpenGL2\ vtkTextureObject.cxx, line 554
> vtkTextureObject (0000029AC7337C70): failed at glBindTexture(0) 1 OpenGL
> errors detected
>   0 : (1282) Invalid operation
>
>
> ERROR: In C:\vtk\src\Rendering\OpenGL2\ vtkTextureObject.cxx, line 540
> vtkTextureObject (0000029AC7337C70): failed at glBindTexture 1 OpenGL
> errors
> detected
>   0 : (1282) Invalid operation
>
>
> ERROR: In C:\vtk\src\Rendering\OpenGL2\ vtkTextureObject.cxx, line 554
> vtkTextureObject (0000029AC7337C70): failed at glBindTexture(0) 1 OpenGL
> errors detected
>   0 : (1282) Invalid operation
>
> ______________________________ _________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
> <http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_
> FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
>
> Search the list archives at: http://markmail.org/search/?q= vtkusers
> <http://markmail.org/search/?q=vtkusers>
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/ mailman/listinfo/vtkusers
> <http://public.kitware.com/mailman/listinfo/vtkusers>
>
>
>
>
> --
> Thales Luis Rodrigues Sabino
>
> PhD Student at PGMC-UFJF <http://www.ufjf.br/pgmc/>
> Lattes <http://lattes.cnpq.br/0601030410417146> | LinkedIn
> <https://br.linkedin.com/in/tluisrs> | ResearchGate
> <https://www.researchgate.net/profile/Thales_Luis_Sabino>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161101/964544eb/attachment.html>


More information about the vtkusers mailing list