[vtkusers] error in callback

Jinyoung Hwang hwangjinyoung at gmail.com
Mon May 17 07:20:58 EDT 2010


Hi folks,

I'm testing callback function in VTK textbook as follows,

void MyClass::KeypressCallbackFunction (vtkObject* obj, unsigned long,
void*, void*)
{
 cout << "modified callback" << endl;
 vtkRenderWindowInteractor *iren =
static_cast<vtkRenderWindowInteractor*>(obj);
 cout << "Pressed: " << iren->GetKeySym() << endl;
 vtkRenderer *ren = reinterpret_cast<vtkRenderer*>(obj);
  cout << ren->GetActiveCamera()->GetPosition()[0] << " "
   << ren->GetActiveCamera()->GetPosition()[1] << " "
   << ren->GetActiveCamera()->GetPosition()[2] << "\n";
}

But, I got an error message at second and third cout function.

---
Unhandled exception in MyClass.exe: 0xC0000005: Access Violation.
---

How to break the error?

regards,
JY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100517/af926266/attachment.htm>


More information about the vtkusers mailing list