diff --git a/Modules/ModuleList.cmake b/Modules/ModuleList.cmake index 89fc1a74f5..6ee8f22a2b 100644 --- a/Modules/ModuleList.cmake +++ b/Modules/ModuleList.cmake @@ -1,83 +1,83 @@ # The entries in the mitk_modules list must be # ordered according to their dependencies. set(mitk_modules Core CommandLine AppUtil DCMTesting RDF LegacyIO DataTypesExt Annotation LegacyGL AlgorithmsExt MapperExt DICOMReader DICOMReaderServices DICOMTesting SceneSerializationBase PlanarFigure ImageDenoising ImageExtraction LegacyAdaptors SceneSerialization Gizmo GraphAlgorithms Multilabel ImageStatistics ContourModel SurfaceInterpolation Segmentation PlanarFigureSegmentation - #OpenViewCore + OpenViewCore QtWidgets QtWidgetsExt C3js QmlItems SegmentationUI DiffusionImaging GPGPU OpenIGTLink IGTBase IGT CameraCalibration RigidRegistration RigidRegistrationUI DeformableRegistration DeformableRegistrationUI OpenCL OpenCVVideoSupport QtOverlays ToFHardware ToFProcessing ToFUI US USUI DicomUI Simulation Remeshing Python QtPython Persistence OpenIGTLinkUI IGTUI VtkShaders DicomRT RTUI IOExt XNAT TubeGraph BiophotonicsHardware Classification TumorInvasionAnalysis MatchPointRegistration MatchPointRegistrationUI BoundingShape RenderWindowManager RenderWindowManagerUI ) if(MITK_ENABLE_PIC_READER) list(APPEND mitk_modules IpPicSupportIO) endif() diff --git a/Modules/OpenViewCore/src/QVTKFramebufferObjectRenderer.cxx b/Modules/OpenViewCore/src/QVTKFramebufferObjectRenderer.cxx index 6ca47209a2..85788265bf 100644 --- a/Modules/OpenViewCore/src/QVTKFramebufferObjectRenderer.cxx +++ b/Modules/OpenViewCore/src/QVTKFramebufferObjectRenderer.cxx @@ -1,91 +1,90 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QVTKInternalOpenglRenderWindow.h" #include "QVTKFramebufferObjectRenderer.h" -#include #include #include #include #include #include #include #include #include #include #include #include #include #include QVTKFramebufferObjectRenderer::QVTKFramebufferObjectRenderer(vtkInternalOpenGLRenderWindow *rw) : m_vtkRenderWindow(rw), m_neverRendered(true), m_readyToRender(false) { m_vtkRenderWindow->Register(NULL); m_vtkRenderWindow->QtParentRenderer = this; } QOpenGLFramebufferObject * QVTKFramebufferObjectRenderer::createFramebufferObject(const QSize &size) { QOpenGLFramebufferObjectFormat format; format.setAttachment(QOpenGLFramebufferObject::Depth); format.setTextureTarget(GL_TEXTURE_2D); format.setInternalTextureFormat(GL_RGBA32F_ARB); QOpenGLFramebufferObject *fbo = new QOpenGLFramebufferObject(size, format); m_vtkRenderWindow->SetFramebufferObject(fbo); return fbo; } void QVTKFramebufferObjectRenderer::render() { if (!m_readyToRender) { return; } m_vtkQuickItem->m_viewLock.lock(); m_vtkRenderWindow->PushState(); m_vtkRenderWindow->OpenGLInitState(); m_vtkRenderWindow->InternalRender(); m_vtkRenderWindow->OpenGLEndState(); m_vtkRenderWindow->PopState(); m_vtkQuickItem->m_viewLock.unlock(); } void QVTKFramebufferObjectRenderer::synchronize(QQuickFramebufferObject * item) { m_vtkQuickItem = static_cast(item); if (m_neverRendered) { m_neverRendered = false; m_vtkQuickItem->init(); } m_readyToRender = m_vtkQuickItem->prepareForRender(); } QVTKFramebufferObjectRenderer::~QVTKFramebufferObjectRenderer() { m_vtkRenderWindow->QtParentRenderer = 0; m_vtkRenderWindow->Delete(); } diff --git a/Modules/OpenViewCore/src/QVTKInternalOpenglRenderWindow.cxx b/Modules/OpenViewCore/src/QVTKInternalOpenglRenderWindow.cxx index 4692118e1c..8743363367 100644 --- a/Modules/OpenViewCore/src/QVTKInternalOpenglRenderWindow.cxx +++ b/Modules/OpenViewCore/src/QVTKInternalOpenglRenderWindow.cxx @@ -1,81 +1,80 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ +#include "vtk_glew.h" #include "QVTKInternalOpenglRenderWindow.h" #include "QVTKFramebufferObjectRenderer.h" -#include #include vtkStandardNewMacro(vtkInternalOpenGLRenderWindow); vtkInternalOpenGLRenderWindow::~vtkInternalOpenGLRenderWindow() { this->OffScreenRendering = false; } vtkInternalOpenGLRenderWindow::vtkInternalOpenGLRenderWindow() : QtParentRenderer(0) { } void vtkInternalOpenGLRenderWindow::InternalRender() { Superclass::Render(); } void vtkInternalOpenGLRenderWindow::OpenGLEndState() { glDepthMask(GL_TRUE); } void vtkInternalOpenGLRenderWindow::OpenGLInitState() { Superclass::OpenGLInitState(); - vtkgl::UseProgram(0); - +// vtkgl::UseProgram(0); TODO18922 glEnable(GL_BLEND); glHint(GL_CLIP_VOLUME_CLIPPING_HINT_EXT, GL_FASTEST); glDepthMask(GL_TRUE); } void vtkInternalOpenGLRenderWindow::Render() { if (this->QtParentRenderer) { this->QtParentRenderer->update(); } } void vtkInternalOpenGLRenderWindow::SetFramebufferObject(QOpenGLFramebufferObject *fbo) { - this->SetFrontBuffer(vtkgl::COLOR_ATTACHMENT0); - this->SetFrontRightBuffer(vtkgl::COLOR_ATTACHMENT0); - this->SetBackLeftBuffer(vtkgl::COLOR_ATTACHMENT0); - this->SetBackRightBuffer(vtkgl::COLOR_ATTACHMENT0); + this->SetFrontBuffer(GL_COLOR_ATTACHMENT0); + this->SetFrontLeftBuffer(GL_COLOR_ATTACHMENT0); + this->SetBackBuffer(GL_COLOR_ATTACHMENT0); + this->SetBackLeftBuffer(GL_COLOR_ATTACHMENT0); QSize fboSize = fbo->size(); this->SetSize(fboSize.width(), fboSize.height()); this->NumberOfFrameBuffers = 1; this->FrameBufferObject = static_cast(fbo->handle()); this->DepthRenderBufferObject = 0; // static_cast(depthRenderBufferObject); this->TextureObjects[0] = static_cast(fbo->texture()); this->OffScreenRendering = true; this->OffScreenUseFrameBuffer = true; this->Modified(); } diff --git a/Modules/OpenViewCore/src/QVTKQuickItem.cxx b/Modules/OpenViewCore/src/QVTKQuickItem.cxx index 63d59948ec..85b713118d 100644 --- a/Modules/OpenViewCore/src/QVTKQuickItem.cxx +++ b/Modules/OpenViewCore/src/QVTKQuickItem.cxx @@ -1,258 +1,256 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // original copyright below /*======================================================================== OpenView -- http://openview.kitware.com Copyright 2012 Kitware, Inc. Licensed under the BSD license. See LICENSE file for details. ========================================================================*/ #include "QVTKQuickItem.h" #include #include #include #include #include #include "QVTKInteractor.h" #include "QVTKMitkInteractorAdapter.h" #include "vtkGenericOpenGLRenderWindow.h" #include "vtkEventQtSlotConnect.h" -#include "vtkgl.h" -#include "vtkOpenGLExtensionManager.h" #include "vtkRenderer.h" #include "vtkCubeSource.h" #include "vtkPolyDataMapper.h" #include "vtkProperty.h" #include #include "QVTKInternalOpenglRenderWindow.h" #include "QVTKFramebufferObjectRenderer.h" QVTKQuickItem::QVTKQuickItem(QQuickItem* parent) : QQuickFramebufferObject(parent) { setAcceptHoverEvents(true); setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton); m_interactor = vtkSmartPointer::New(); m_interactorAdapter = new QVTKMitkInteractorAdapter(this); m_connect = vtkSmartPointer::New(); m_win = vtkInternalOpenGLRenderWindow::New(); m_interactor->SetRenderWindow(m_win); m_connect->Connect(m_win, vtkCommand::WindowIsCurrentEvent, this, SLOT(IsCurrent(vtkObject*, unsigned long, void*, void*)), NULL, 0.0, Qt::DirectConnection); m_connect->Connect(m_win, vtkCommand::WindowIsDirectEvent, this, SLOT(IsDirect(vtkObject*, unsigned long, void*, void*)), NULL, 0.0, Qt::DirectConnection); m_connect->Connect(m_win, vtkCommand::WindowSupportsOpenGLEvent, this, SLOT(SupportsOpenGL(vtkObject*, unsigned long, void*, void*)), NULL, 0.0, Qt::DirectConnection); connect(this, SIGNAL(textureFollowsItemSizeChanged(bool)), this, SLOT(onTextureFollowsItemSizeChanged(bool))); } QVTKQuickItem::~QVTKQuickItem() { if(m_win) { m_connect->Disconnect(m_win, vtkCommand::WindowIsCurrentEvent, this, SLOT(IsCurrent(vtkObject*, unsigned long, void*, void*))); m_connect->Disconnect(m_win, vtkCommand::WindowIsDirectEvent, this, SLOT(IsDirect(vtkObject*, unsigned long, void*, void*))); m_connect->Disconnect(m_win, vtkCommand::WindowSupportsOpenGLEvent, this, SLOT(SupportsOpenGL(vtkObject*, unsigned long, void*, void*))); m_win->Delete(); } } QSGNode* QVTKQuickItem::updatePaintNode(QSGNode *node, QQuickItem::UpdatePaintNodeData *nodeData) { if (!node) { node = QQuickFramebufferObject::updatePaintNode(node, nodeData); QSGSimpleTextureNode *n = static_cast(node); if (n) n->setTextureCoordinatesTransform(QSGSimpleTextureNode::MirrorVertically); return node; } return QQuickFramebufferObject::updatePaintNode(node, nodeData); } QQuickFramebufferObject::Renderer *QVTKQuickItem::createRenderer() const { return new QVTKFramebufferObjectRenderer(static_cast(m_win)); } vtkOpenGLRenderWindow* QVTKQuickItem::GetRenderWindow() const { return m_win; } QVTKInteractor* QVTKQuickItem::GetInteractor() const { return m_interactor; } void QVTKQuickItem::IsCurrent(vtkObject*, unsigned long, void*, void* call_data) { bool* ptr = reinterpret_cast(call_data); *ptr = QOpenGLContext::currentContext() == this->window()->openglContext(); } void QVTKQuickItem::IsDirect(vtkObject*, unsigned long, void*, void* call_data) { int* ptr = reinterpret_cast(call_data); *ptr = 1; } void QVTKQuickItem::SupportsOpenGL(vtkObject*, unsigned long, void*, void* call_data) { int* ptr = reinterpret_cast(call_data); *ptr = 1; } void QVTKQuickItem::onTextureFollowsItemSizeChanged(bool follows) { if (!follows) { qWarning("QVTKQuickItem: Mouse interaction is not (yet) supported when textureFollowsItemSize==false"); } } void QVTKQuickItem::geometryChanged(const QRectF & newGeometry, const QRectF & oldGeometry) { QQuickFramebufferObject::geometryChanged(newGeometry, oldGeometry); QSize oldSize(oldGeometry.width(), oldGeometry.height()); QSize newSize(newGeometry.width(), newGeometry.height()); QResizeEvent e(newSize, oldSize); if (m_interactorAdapter) { this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(&e, m_interactor); this->m_viewLock.unlock(); } } void QVTKQuickItem::keyPressEvent(QKeyEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::keyReleaseEvent(QKeyEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::mousePressEvent(QMouseEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::mouseReleaseEvent(QMouseEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::mouseDoubleClickEvent(QMouseEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::mouseMoveEvent(QMouseEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::wheelEvent(QWheelEvent* e) { e->accept(); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(e, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::hoverEnterEvent(QHoverEvent* e) { e->accept(); QEvent e2(QEvent::Enter); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(&e2, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::hoverLeaveEvent(QHoverEvent* e) { e->accept(); QEvent e2(QEvent::Leave); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(&e2, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::hoverMoveEvent(QHoverEvent* e) { e->accept(); QMouseEvent e2(QEvent::MouseMove, e->pos(), Qt::NoButton, Qt::NoButton, e->modifiers()); this->m_viewLock.lock(); m_interactorAdapter->ProcessEvent(&e2, m_interactor); this->m_viewLock.unlock(); update(); } void QVTKQuickItem::init() { m_win->OpenGLInitContext(); - m_win->GetExtensionManager()->LoadExtension("GL_VERSION_1_4"); - m_win->GetExtensionManager()->LoadExtension("GL_VERSION_2_0"); +// m_win->GetExtensionManager()->LoadExtension("GL_VERSION_1_4"); +// m_win->GetExtensionManager()->LoadExtension("GL_VERSION_2_0"); } bool QVTKQuickItem::prepareForRender() { return true; } void QVTKQuickItem::cleanupAfterRender() { }