[vtkusers] Updating color of actor without call renderWindow->Render()

Andras Lasso lasso at queensu.ca
Thu May 3 08:57:47 EDT 2018


You may use ctkVTKAbstractView (or copy-paste its rendering mechanism into your code). It has a scheduleRender() method that you call instead of directly calling Render(). The class makes sure that actual rendering does not happen more frequently than the DesiredUpdateRate set in the render window.

http://www.commontk.org/docs/html/classctkVTKAbstractView.html
https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h

Or, you may enable “vsync” in your GPU driver, which delays your rendering thread if it gets rendering request more frequently than the refresh rate of your monitor.

Andras

From: vtkusers <vtkusers-bounces at vtk.org> On Behalf Of Ken Martin
Sent: Thursday, May 3, 2018 8:40 AM
To: Voigteri <eric.voigt at outlook.de>
Cc: vtk <vtkusers at vtk.org>
Subject: Re: [vtkusers] Updating color of actor without call renderWindow->Render()

If the events/actions that cause a color change can happen significantly faster than your render rate then you should break apart the two actions (changing the color and rendering). Have a queue of color changes that you push to and then on the next render pop all the ones that have accumulated. The rendering can be driven by a timer. That way you can have 500 Hz of color changes and a 30Hz render rate for example.



On Thu, May 3, 2018 at 3:53 AM, Voigteri <eric.voigt at outlook.de<mailto:eric.voigt at outlook.de>> wrote:
Hi all,

I have a long list of actors and I periodically (very short time intervals)
update the color of these actors with

actors[i]->GetProperty()->SetColor(r,g,b);
renderWindow->Render()

after each color change. However, this redraws the entire scene, not just
the actor I am updating and causes my application to become quite sluggish
since the colors can be changed interactively by the user at a fast pace.

Is there a better/more efficient way to do this?

Kind regards,

Eric



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvtk.1045678.n5.nabble.com%2FVTK-Users-f1224199.html&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=TBTF7TftjeVcy94Tidh4LkCA9pKnpRSL67iJOEzOOak%3D&reserved=0>
_______________________________________________
Powered by www.kitware.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=vCswGkTWQLI2il%2BPGzDBsShx15HceG1no4Eb1jxgn6s%3D&reserved=0>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=DDH8gH5RDRSVicbITafZxNAsE9z%2BXxy4bCBWlhdHpdo%3D&reserved=0>

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.vtk.org%2FWiki%2FVTK_FAQ&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=o456bM6S49LoP2kDI3DTt9bVwfHsCEw7J0f6e7B452Q%3D&reserved=0>

Search the list archives at: http://markmail.org/search/?q=vtkusers<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtkusers&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=CWc884%2FDwR8jWYgV7wvJZ33jriTBNKaVteQIoKYq3M4%3D&reserved=0>

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvtk.org%2Fmailman%2Flistinfo%2Fvtkusers&data=02%7C01%7Classo%40queensu.ca%7Ce69d08dd4b134242e85508d5b0f2f815%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636609479945648816&sdata=eLPbG8nzfFN4ue0HxCEAVbBVLG5h4RHbcdmB%2F9M1DP8%3D&reserved=0>



--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
101 East Weaver Street
Carrboro, North Carolina
27510 USA
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: <https://vtk.org/pipermail/vtkusers/attachments/20180503/16af1116/attachment.html>


More information about the vtkusers mailing list