[vtkusers] ] update,interact and render in different threads

Andrew Maclean andrew.amaclean at gmail.com
Thu Dec 29 00:23:41 EST 2016


Your problem is in the modified callback. There is no need for this
callback since
 while the rendering takes place this callback is invoked many times hence
the OpenGL errors.
 So remove:
"cellData->AddObserver(vtkCommand::ModifiedEvent,ModifiedCallback);"
 By adding this observer to CellData you are forcing a reload of cell data
whenever any event happens during rendering.

Now, you only need the InteractionEndCallBack observer since you are only
interested in updating the end result.
 If you leave in InteractionStartCallBack then the object is updated twice.
Once at the start of interaction and then at the end of interaction.
 After all you are only interested in the result after the interaction has
ended.
 Also remove "ComputerRGB();" on line 75 as this is not needed since this
is called in the thread.

Addidionally
"#include <X11/Xlib.h>"
and
"XInitThreads();"

are not needed at all.


---------- Forwarded message ----------
> From: Antonio Fortino <thoniorf at gmail.com>
> To: vtkusers at vtk.org
> Cc:
> Date: Wed, 28 Dec 2016 17:59:13 +0100
> Subject: [vtkusers] update,interact and render in different threads
> Hello to everyone,
>
> I'm trying to develop a simple example that update the celldata of a
> polydata in a thread while rendering in the main thread.
> My final goal is to interact with the scene, and pause the updates.
>
> To archive this i'm using a simple mutex and a boolean.
> However it seams that i'm trying to access the render for two different
> threads, and the mutex isn't enough, because when interacting with the
> scene errors like the one below appears, and at random the program stops
> with a segmentation.
>
> vtkOpenGLPolyDataMapper (0x1b62980): failed after UpdateShader 1 OpenGL
> errors detected
>
> 0 : (1282) Invalid operation
>
>
> I attach the code, any help is very appreciated.
>
> Best regards
> Antonio Fortino
>
>
>
>
> _______________________________________________
> 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
>



-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/e8728e04/attachment.html>


More information about the vtkusers mailing list