[vtkusers] question about vtkCommand

qlizhi qlizhi at gmail.com
Tue Apr 24 05:34:33 EDT 2012


I have got the answer, the render does not show nothing, actually, the actor shows very very small,  when i zoom in i got the actor. Thanks for reply!




qlizhi

From: qlizhi
Date: 2012-04-24 16:53
To: Darshan Pai
CC: vtkusers
Subject: Re: Re: [vtkusers] question about vtkCommand
For testing, i move the operation to right button menu,  and just use [actor->RotateX(30.0)]. But the result was the same, after i clicked the rightButton menu , the render window show nothing. Besides, i tried another test, i changed my data source to vtkConeSource ,  it runs Ok.  My former data source was :
  vtkPolyData *linesPolyData = vtkPolyData::New();
  linesPolyData->SetPoints(Points);
  linesPolyData->SetLines(lines);






qlizhi

From: Darshan Pai
Date: 2012-04-24 00:14
To: qlizhi
CC: vtkusers
Subject: Re: Re: [vtkusers] question about vtkCommand
One more question . Are you calling Render() in the thread or the main program ?


On Mon, Apr 23, 2012 at 12:12 PM, Darshan Pai <darshanpai at gmail.com> wrote:

I meant to not use SetOrientation at all and instead use the Transform or the matrix 



On Mon, Apr 23, 2012 at 3:50 AM, qlizhi <qlizhi at gmail.com> wrote:

i have tried  SetUserMatrix() , the result is the same. it seems that after [actor->SetOrientation(ori)]  the actor lost its data source, so it render nothing.




qlizhi

From: Darshan Pai
Date: 2012-04-23 12:42
To: qlizhi
CC: David Doria; vtkusers
Subject: Re: [vtkusers] question about vtkCommand
Why not try using SetUserTransform() or SetUserMatrix()


On Mon, Apr 23, 2012 at 12:32 AM, qlizhi <qlizhi at gmail.com> wrote:

Thanks for reply:
            here is my main code, and if i use [window->Render()], there will be an error:
ERROR: In D:\Program Files (x86)\VTK 5.8.0\VTK\Rendering\vtkWin32OpenGLRenderWindow.cxx, line 247
vtkWin32OpenGLRenderWindow (06DFC0B0): wglMakeCurrent failed in MakeCurrent(), error: The requested resource is in use.

void CupGeologyView::addInternetEvent( vtkActor *actor, vtkRenderWindow *window)
{
/*actor->SetOrientation(27.0, 27.0, 27.0);*/
internetEvent = new cupVtkUserInternetEvent;
QThread * thread = new QThread(this);
internetEvent->moveToThread(thread);
connect(ui.allowInternetEvent, SIGNAL(triggered()), internetEvent, SLOT(init()));
thread->start();

CupRemoteModelCallback *mo1 = CupRemoteModelCallback::New();
mo1->actor = actor;
mo1->window = window;
internetEvent->AddObserver(vtkCommand::UserEvent,mo1);
mo1->Delete();
}

void CupRemoteModelCallback::Execute( vtkObject *caller, unsigned long eventId, void *callData )
{
cupVtkUserInternetEvent *internetEvent = reinterpret_cast<cupVtkUserInternetEvent *>(caller);
if (eventId = vtkCommand::UserEvent)
{
if (actor!= NULL && window != NULL)
{
//to-do
int* xyz = (int*)callData;
double ori[3];
ori[0] = xyz[0];
ori[1] = xyz[1];
ori[2] = xyz[2];
actor->SetOrientation(ori);
/*window->Render();*/
} 
}
}




qlizhi

From: David Doria
Date: 2012-04-22 21:53
To: qlizhi
CC: vtkusers
Subject: Re: [vtkusers] question about vtkCommand
2012/4/22 qlizhi <qlizhi at gmail.com>


hi, all!
i write a subclass of vtkCommand, and in its function Execute(), i try to change an actor's Orientation by code [actor->SetOrientation(ori)].
I made breakPoint on that line, it runs. But   the renderWindow  show nothing. Can anybody tell me why?
Sorry for my poor english!



qlizhi
Did you call renderWindow->Render()? You'll probably have to make us an as-small-as-possible code sample so we can see exactly what you're doing.

David


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120424/b4b83984/attachment.htm>


More information about the vtkusers mailing list