15 #include <vtkRenderWindow.h> 16 #include <vtkOpenGLRenderWindow.h> 17 #include "QVTKWidget.h" 28 this->preventSharedContextRenderWindowFromBeingShownOnScreen(renderWindow);
29 renderWindow->Render();
32 void RenderWindowFactory::preventSharedContextRenderWindowFromBeingShownOnScreen(
vtkRenderWindowPtr renderWindow)
34 mQvtkWidgetForHidingSharedContextRenderWindow =
new QVTKWidget();
35 mQvtkWidgetForHidingSharedContextRenderWindow->SetRenderWindow(renderWindow);
42 return mRenderWindows[uid];
51 return (mRenderWindows.count(uid) > 0);
56 if(!mSharedRenderWindow)
58 CX_LOG_WARNING() <<
"RenderWindowFactory::getSharedRenderWindow(): No shared opengl renderwindow available.";
60 return mSharedRenderWindow;
65 if(mSharedRenderWindow == sharedRenderWindow)
69 mSharedRenderWindow = sharedRenderWindow;
72 if(opengl_renderwindow)
78 CX_LOG_WARNING() <<
"RenderWindowFactory::setSharedRenderWindow(): got no opengl render window.";
84 return mSharedOpenGLContext;
87 vtkRenderWindowPtr RenderWindowFactory::createRenderWindow(QString uid,
bool offScreenRendering)
90 renderWindow->SetOffScreenRendering(offScreenRendering);
92 mSharedContextCreatedCallback = SharedContextCreatedCallbackPtr::New();
93 mSharedContextCreatedCallback->setRenderWindowFactory(
this);
96 if(!opengl_renderwindow)
98 CX_LOG_ERROR() <<
"The created renderwindow is not an opengl renderwindow.";
100 opengl_renderwindow->AddObserver(vtkCommand::CXSharedContextCreatedEvent, mSharedContextCreatedCallback);
102 mRenderWindows[uid] = renderWindow;
vtkRenderWindowPtr getRenderWindow(QString uid, bool offScreenRendering=false)
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
SharedOpenGLContextPtr getSharedOpenGLContext() const
vtkSmartPointer< class vtkOpenGLRenderWindow > vtkOpenGLRenderWindowPtr
boost::shared_ptr< class SharedOpenGLContext > SharedOpenGLContextPtr
vtkRenderWindowPtr getSharedRenderWindow() const
bool renderWindowExists(QString uid)
Namespace for all CustusX production code.