[vtkusers] Updating scene continously

Vodka Vodka vodka at hkem.com
Fri Jun 2 12:08:22 EDT 2000


Hi Paul,
     My tool is vc and platform in win32. As I don't know much 
about MFC, I try hard to understand it but still can't figure 
out what's happening.
     I have a question that, can you suggested algorithm 
process my data in real time? Or I have to create all the data slices and run your algorithm for visualing the data as movie?
     May be I don't explain what I want clearly in my previous 
post. What I'm thinkig is that, there are 2 programs. One is 
for simulation and will update a DATA file after a simulation 
step, there are just 1 DATA file(the program has been completed and works fine). Another program written by vtk is running concurrently and read in the DATA file every second 
and update the display. Simulation and the display of simulation result are carried out simultaneously by 2 different programs.
     I wonder if your suggested algorithm capable to do so?
     Thanks a lot for your kindly help and looking forward to
your reply.



On Fri, 2 Jun 2000 21:44:02 +0800, you wrote:

>I'm using vtk to display my simulation result. 
>I want the simulated result to be display on the screen continously. My simulation program will write data in a specific file(xxx.1, xxx.2, xxx.3) in every step of the simulation and a small vtk program is being written to display the data.
>
>I'm using vtkPolydata for carrying the data read in.
>Due to the architecture of vtk, I do know that, once the content in my vtkPolydata change and if renWin->Render() is triggered. Then the scene will be updated. But my problem is how to trigger 
>renWin->Render() after the "iren->Start()"???
>
>I know think of something "Timer", "onTimer" which read in new data and trigger "iren->Start" in specific time interval. But how to set this kind of timer? Can anyone help??
>
>Also, does anyone has another better approach to my problem??
>_____________________________________________________
>Sent by Hong Kong E-Mail at http://www.hkem.com
>It's free. It's easy. Sign up your account Now! 
>
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>vtkusers mailing list
>vtkusers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtkusers

ASSUMTION:
I assume you are implementing this on WIN32 (NT/95)

I would not recommend using a timer to generate your animation.

This is what I am doing:
---------------------------------------------------
I have a render window owned by a modal dialog box.

This is the overloaded window proc from the dialog:

///////////////////////////////////////////////////////////////////////////////
LRESULT MovieDlg::WindowProc(UINT message, WPARAM wParam, LPARAM
lParam) 
{
        if( message == WM_KICKIDLE )
        {
                // If there are more frames to process
                if( m_pController->ProcessTimeSlice() )
                        return 1L;
                else
                        return 0L;
        }
        return SmartDlg::WindowProc(message, wParam, lParam);
}

This is the time slice processor:
I pre create an array of position data for the movie, and then iterate
though that array to "play" the movie.

/////////////////////////////////////////////////////////////
bool Movie::ProcessTimeSlice()
{
        bool fMoreToDo = false;

        if( m_pPos && IsPlaying() )
        {
                // Move the sustainer
                GetRender3D()->GetAssembly( 1 )->AddPosition(
m_pPos->deltaX, m_pPos->deltaY, m_pPos->deltaZ );
                GetRender3D()->GetAssembly( 1 )->RotateZ(
m_pPos->deltaTheta );

                // Move the camera to track the target
                LookAt( m_pFlightPos->targetX, m_pPos->targetY,
m_pPos->targetZ );

                // Iterate to the next flight position.
                m_pPos = m_Path.GetNextPosition();

                if( m_pPos )
                        fMoreToDo = true;

                GetRender3D()->Refresh( ); // Calls iren->Render()
        }
        return fMoreToDo;
}

/////////////////////////////////////////////////////////////////////
There is a descent article on using this technique at:
http://www.wdj.com/archive/0807/feature.html


I hope this helps.

Regards,
Paul.




_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
vtkusers mailing list
vtkusers at public.kitware.com
http://public.kitware.com/mailman/listinfo/vtkusers


_____________________________________________________
Sent by Hong Kong E-Mail at http://www.hkem.com
It's free. It's easy. Sign up your account Now! 





More information about the vtkusers mailing list