[vtkusers] Re nder observer events

hampycalc i.am.tom.hampshire at googlemail.com
Sun Nov 29 07:11:44 EST 2009


I am invoking the Render() method from my main thread (my app code is not
multithreaded), however I am not instantiating the renderwindow-interactor
pair myself as I am using a QVTKWidget in my QT gui.


Karthik Krishnan-2 wrote:
> 
> How exactly are you doing this ? Are you invoking the "Render()"
> method from a thread that is not the one instantiating the
> renderwindow-interactor pair. Don't you run into nasty issues then ?
> 
> 
> 
> On Fri, Nov 27, 2009 at 11:39 AM, hampycalc
> <i.am.tom.hampshire at googlemail.com> wrote:
>>
>> Hi everyone, I have been tearing my hair out trying to find a solution to
>> this problem, and think I'm quite close, just not quite there yet.
>> I am using a vtkCameraInterpolator to generate a fly through, similarly
>> to
>> how it is implemented here:
>> http://www.vtk.org/doc/nightly/html/c2_vtk_t_3.html#c2_vtk_t_vtkCameraInterpolator
>> only in C++. However, it renders very slowly due to the fact that
>> vtkRenderWindow->Render() is called multiple times in the loop, creating
>> multiple new threads, before it actually renders a frame. I want to check
>> if
>> the frame has been rendered correctly (and the render thread has ended)
>> before making another call to vtkRenderWindow->Render(), and have
>> attemped
>> to do this by subclassing vtkCommand and attaching it to the vtkRenderer
>> as
>> an observer and look for vtkCommand::EndEvent and vtkCommand::StartEvent
>> events. However, these seem to be called directly after one another,
>> regardless of whether the frame has been rendered correctly. The
>> vtkCommand
>> I am using is:
>>
>> class vtkRenderFinish : public vtkCommand
>> {
>>    public:
>>        static vtkRenderFinish *New()
>>        {
>>                        vtkRenderFinish *v = new vtkRenderFinish;
>>                        v->finished = true;
>>                        return v;
>>        }
>>
>>        void Delete()
>>        {
>>                        delete this;
>>        }
>>
>>        virtual void Execute(vtkObject *caller, unsigned long eventId,
>> void*
>> arguments)
>>        {
>>                        if (eventId == vtkCommand::EndEvent)
>>                                finished = true;
>>                        else if (eventId == vtkCommand::StartEvent)
>>                                finished = false;
>>        }
>>
>>        bool isFinished(){
>>                        return finished;
>>        }
>>
>> private:
>>        bool finished;
>> };
>>
>> And I am attempting to halt the vtkRenderWindow->Render() by putting:
>>
>> while(!vtkRenderFinish->isFinished()){
>>        Sleep(10);
>> }
>>
>> before it. The inside of this while statement is never reached, which
>> leads
>> me to believe I am not observing the correct object and/or commands.
>> Any help would be greatly appreciated.
>> --
>> View this message in context:
>> http://old.nabble.com/Render-observer-events-tp26544829p26544829.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> 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
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
> _______________________________________________
> 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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 

-- 
View this message in context: http://old.nabble.com/Render-observer-events-tp26544829p26560655.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list