[vtkusers] Re: Some question of the using of vtkWin32VideoSource

zhangzhijun zjzhang at ee.cuhk.edu.hk
Mon May 21 13:58:03 EDT 2001


Dear david:
        But actually when I run the video.tcl the second time after I reset
my computer , there will be the "can't find video card" .
        also I have use the multi-thread in a MFC based application
and every time in the work thread it will  gives a update message to call
update redraw the video window, and in the update function for the video
window function these code is written: but I can only get a static image in
 the video window, and it doesn't change with the frames of image changes.
 and the program also turns to be very slow.
void CVideoView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
 // TODO: Add your specialized code here and/or call the base class
  this->GetDocument()->pView3=this;
  vtkPropCollection *propc;
  vtkProp *prop;
  // first remove any old actors
  this->Renderer->GetProps()->RemoveAllItems();
  this->GetDocument()->videoSource->Grab();
  propc = this->GetDocument()->GetProps1();
  propc->InitTraversal();
  while (prop = propc->GetNextProp())
    {
    this->Renderer->AddProp(prop);
   this->Renderer->ResetCamera();
   this->Renderer->SetBackground(0.2,0.3,0.4);
    }
  this->vtkMFCRenderView::OnUpdate(pSender, lHint, pHint);
}


Regards,
zj zhang

----- Original Message -----
From: David Gobbi <dgobbi at irus.rri.on.ca>
To: zhangzhijun <zjzhang at ee.cuhk.edu.hk>
Cc: <vtkusers at public.kitware.com>
Sent: Tuesday, May 22, 2001 1:14 AM
Subject: Re: Some question of the using of vtkWin32VideoSource


> Hi Zhang,
>
> The problem is that while the 'for' loop is running, Windows is unable
> to process events.  This is not a problem with e.g. the
> vtkMILVideoSource because the MIL interface is multi-threaded, but
> unfortunately Video for Windows relies on Windows event handling to
> process the callbacks.
>
> The only solution is for you write a program that does proper event
> handling.  If you call Grab from somewhere within your main WNDPROC
> message handler, then Video for Windows won't be blocked.
> Does anyone out there who has used vtkWin32VideoSource have a simple
> example of this?  I don't do much applications-level programming
> in C++ myself.
>
> Another solution is to write your program in tcl or python/Tkinter
> and to only do the grabs after you have started the 'mainloop'.
> See 'video.tcl' for an example.
>
>  - David
>
> --
>   David Gobbi, MSc                    dgobbi at irus.rri.on.ca
>   Advanced Imaging Research Group
>   Robarts Research Institute, University of Western Ontario
>
>





More information about the vtkusers mailing list