[vtkusers] Using thread with vtk

Ntfs ntfs at hkem.com
Fri Jun 9 14:49:24 EDT 2000


Can anyone help? The attachment is the program that I've struggled over
nights.
But still fail to find what's wrong. Actually, it's modified from the
example expcos.cxx.
As I'm working with something related to real time visualization. So, I
want to test
if thread can work properly with vtk. The following is the code for
threading. Due
to the code "ren->GetActiveCamera()->Azimuth(10);". I expect the actor
in
the window will azimuth(10) every 0.5s. But for my surprise, it
doesn't!! Can anyone
tell me what's wrong? Many thanks


DWORD WINAPI modify_field(LPVOID lParam)
{
    int dummy=0;

    while (1)
    {

        bessel->CopyStructure(transF->GetOutput());
        bessel->SetPoints(newPts);
        bessel->GetPointData()->SetScalars(derivs);

        //Change the data
        for (i=0; i<(int)(numPts/6); i++)
        {
            transF->GetOutput()->GetPoint(i,x);
            x[2] =dummy;

            newPts->SetPoint(i,x);
            derivs->SetScalar(i,x[2]);
        }

        dummy++;
        // warp plane
        warp->SetInput(bessel);
        warp->XYPlaneOn();
        warp->SetScaleFactor(0.5);

        // mapper and actor
        mapper->SetInput(warp->GetOutput());
        mapper->SetScalarRange(bessel->GetScalarRange());

        carpet->SetMapper(mapper);

        ren->GetActiveCamera()->Azimuth(10);
        renWin->Render();

        printf("dummy = %d\n",dummy);
        Sleep(500);
    }


    return(0);
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: expCos1.cxx
Type: application/x-unknown-content-type-cxxfile
Size: 3337 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20000610/fb63de01/attachment-0001.bin>


More information about the vtkusers mailing list