<div>Hi folks,</div>
<div> </div>
<div>I'm testing callback function in VTK textbook as follows,</div>
<div> </div>
<div>void MyClass::KeypressCallbackFunction (vtkObject* obj, unsigned long, void*, void*)<br>{<br> cout << "modified callback" << endl; <br> vtkRenderWindowInteractor *iren = static_cast<vtkRenderWindowInteractor*>(obj); <br>
cout << "Pressed: " << iren->GetKeySym() << endl;</div>
<div> vtkRenderer *ren = reinterpret_cast<vtkRenderer*>(obj);</div>
<div> cout << ren->GetActiveCamera()->GetPosition()[0] << " "<br> << ren->GetActiveCamera()->GetPosition()[1] << " "<br> << ren->GetActiveCamera()->GetPosition()[2] << "\n";</div>
<div>}</div>
<div> </div>
<div>But, I got an error message at second and third cout function.</div>
<div> </div>
<div>---</div>
<div>Unhandled exception in MyClass.exe: 0xC0000005: Access Violation.</div>
<div>---</div>
<div> </div>
<div>How to break the error?</div>
<div> </div>
<div>regards,</div>
<div>JY</div>