| 49 | } |
| 50 | |
| 51 | void mitk::RenderingTestHelper::Initialize(int width, int height, AntiAliasing antiAliasing) |
| 52 | { |
| 53 | RenderingManager::GetInstance()->SetAntiAliasing(antiAliasing); |
| 54 | |
| 55 | mitk::UIDGenerator uidGen = mitk::UIDGenerator("UnnamedRenderer_"); |
| 56 | m_RenderWindow = mitk::RenderWindow::New(nullptr, uidGen.GetUID().c_str()); |
| 57 | |
| 58 | auto renderWindow = m_RenderWindow->GetVtkRenderWindow(); |
| 59 | |
| 60 | if (0 == renderWindow->SupportsOpenGL()) |
| 61 | { |
| 62 | auto openGLRenderWindow = dynamic_cast<vtkOpenGLRenderWindow*>(renderWindow); |
| 63 | |
| 64 | auto message = nullptr != openGLRenderWindow |
| 65 | ? openGLRenderWindow->GetOpenGLSupportMessage() |
| 66 | : std::string("No details available."); |
| 67 | |
| 68 | mitkThrowException(mitk::TestNotRunException) << "OpenGL not supported: " << message; |
| 69 | } |
| 70 | |
| 71 | m_DataStorage = mitk::StandaloneDataStorage::New(); |
| 72 | |
| 73 | m_RenderWindow->GetRenderer()->SetDataStorage(m_DataStorage); |
| 74 | this->SetMapperIDToRender2D(); |
| 75 | this->GetVtkRenderWindow()->SetSize(width, height); |
| 76 | |
| 77 | m_RenderWindow->GetRenderer()->Resize(width, height); |
| 78 | } |
| 79 | |
| 80 | mitk::RenderingTestHelper::~RenderingTestHelper() |
| 81 | { |
no test coverage detected