[vtkusers] Fwd: ] update,interact and render in different threads
Antonio Fortino
thoniorf at gmail.com
Thu Dec 29 05:30:50 EST 2016
Thank you Andrew i had forgotten that isolated ComputerRGB().
Forgive me i wasn't clear, but i added the observer to the celldata to
render every time the cells are updated, and the interactions callbacks
handle just the mutex to prevent the cells updates while i'm interaction.
Is there another way to do ?
Thank you again for your help.
Antonio Fortino
2016-12-29 6:23 GMT+01:00 Andrew Maclean <andrew.amaclean at gmail.com>:
>
> 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,ModifiedCal
> lback);"
> 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--
>>
> ___________________________________________
> Andrew J. P. Maclean
>
> ___________________________________________
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161229/c9e3adb9/attachment.html>
More information about the vtkusers
mailing list