<p><br>subject:Fullscreen mode problem<br>Hi,</p>
<p>I'm having some trouble with the vtkRenderWindow full screen mode under <br>X11. When I activate full screen mode, the window renders to full screen <br>correctly, however all keyboard/mouse interaction with the window appears <br>
to cease, ie no further clicks/keypresses are received by the application.</p>
<p>hier is the code:<br> typedef int PipeHandle;<br> XtAppContext app_context; <br>void handle_timer(vtkObject* caller, unsigned long, void* clientdata, void*)<br>{<br> vtkRenderWindowInteractor* iren= static_cast<vtkInteractorStyle*>(caller)->GetInteractor();<br>
vtkCamera* cam = reinterpret_cast<vtkCamera*>(clientdata);<br> iren->CreateTimer(VTKI_TIMER_UPDATE);<br> iren->Render();<br> }</p>
<p>void handle_console_event(PipeHandle handle)<br>{<br> static char buf[1024];<br> int num_read=0;<br> num_read = read(handle, buf, 1024);</p>
<p> if(num_read == 5 && (strncmp("exit", buf, 4) == 0 || strncmp("quit", buf, 4) == 0))<br> {<br> XtAppSetExitFlag(app_context);<br> }<br>}</p>
<p>static void x11_handle_console_event(XtPointer, int* pipe, XtInputId*)<br>{<br> handle_console_event(*pipe);<br>}</p>
<p>class vtkMyCallback : public vtkCommand <br>{ <br> public:<br> static vtkMyCallback *New() <br> { <br> return new vtkMyCallback; <br> } <br> <br> virtual void Execute(vtkObject *caller1, unsigned long, void*) <br>
{<br> vtkXRenderWindowInteractor *interact = reinterpret_cast<vtkXRenderWindowInteractor*>(caller1);<br> <br> char* key = interact->GetKeySym();<br> if (*key=='g') <br>
{ <br> this->Actor->GetProperty()->SetColor(0,1,0);</p>
<p> }<br> <br> if (*key=='b') <br> { <br> this->Actor->GetProperty()->SetColor(0,0,1); <br> }<br> <br> if (*key=='r') <br>
{ <br> this->Actor->GetProperty()->SetColor(1,0,0); <br> }</p>
<p> }</p>
<p> void SetActor(vtkActor *actor) <br> { <br> this->Actor = actor;<br> }</p>
<p> protected: <br> vtkActor *Actor;<br> vtkRenderWindow* renWin;<br>};</p>
<p>int main()<br>{<br> XtToolkitInitialize();<br> app_context = XtCreateApplicationContext();<br> XtAppAddInput(app_context, fileno(stdin), (XtPointer)XtInputReadMask,x11_handle_console_event, NULL);<br> <br>vtkRenderer* ren1 = vtkRenderer::New();<br>
vtkRenderWindow* renWin = vtkRenderWindow::New();<br> renWin->AddRenderer (ren1);</p>
<p>vtkXRenderWindowInteractor* iren1 = vtkXRenderWindowInteractor::New();<br> iren1->SetRenderWindow(renWin);<br> iren1->Initialize(app_context); <br> <br>vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br>
iren1->SetInteractorStyle(style);</p>
<p>vtkCylinderSource *cylinder1 = vtkCylinderSource::New();<br> cylinder1->SetCenter(0,0,0); <br> cylinder1->SetRadius(1);<br> cylinder1->SetHeight(2);<br> cylinder1->SetResolution(100); </p>
<p> <br> vtkPolyDataMapper *cylinderMapper1 = vtkPolyDataMapper::New();<br> cylinderMapper1->SetInputConnection (cylinder1 ->GetOutputPort());</p>
<p>vtkActor *cylinderActor1 = vtkActor::New();<br> cylinderActor1->SetMapper(cylinderMapper1);<br> cylinderActor1->GetProperty()->SetColor(1,0,0);<br> cylinderActor1->SetPosition(1,1,1); <br> <br> ren1->AddActor(cylinderActor1);<br>
ren1->SetBackground(1, 1, 1 );<br> renWin->FullScreenOn(); <br> <br>vtkCamera *cam1 = vtkCamera::New();<br> ren1->ResetCamera();<br> cam1 = ren1->GetActiveCamera();<br> <br>vtkCallbackCommand* callback = vtkCallbackCommand::New();<br>
callback->SetClientData(cam1);<br> callback->SetCallback(handle_timer);<br> style->AddObserver(vtkCommand::TimerEvent, callback);</p>
<p>vtkMyCallback *cb = vtkMyCallback::New();<br> cb->SetActor(cylinderActor1);<br> style->AddObserver(vtkCommand::KeyReleaseEvent ,cb);<br> iren1->CreateTimer(VTKI_TIMER_FIRST);</p>
<p> printf("type 'exit' to quit\n"); <br> <br> while(!XtAppGetExitFlag(app_context))<br> {<br> float x=0,y=0,z=0;<br> for( double i = 0; i<9;i++)<br> {<br> {x=fmod(i,6);<br>
y=fmod(i,3);<br> z=fmod(i,9);<br> }<br> cylinderActor1 ->SetPosition(x,y,z);<br> XtAppProcessEvent(app_context, XtIMAll);<br> <br> } <br> }<br> return 0;<br>
}</p>
<p>I am using Debian with VTK5.0, on a system with NVIDIA drivers.<br>Can anyone offer any suggestions as to why this is happening?</p>
<p>-- <br>Cheers,<br>ouanabil<br></p>