From: tbaudier Date: Mon, 6 Jun 2016 07:44:44 +0000 (+0200) Subject: Ensure compilation with OpenGL2 (VTK7) X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c2957bcf8c939423525b848df4c97e5ccadedb4c;p=clitk.git Ensure compilation with OpenGL2 (VTK7) --- diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index a871fec..ef74409 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -31,6 +31,9 @@ if(VTK_FOUND) vtkQVTK ) endif(VTK_VERSION VERSION_LESS 5.6.0) + if("${VTK_RENDERING_BACKEND}" STREQUAL "OpenGL2") + add_definitions(-DVTKGL2) + endif() else(VTK_FOUND) message(FATAL_ERROR "Please set VTK_DIR.") endif(VTK_FOUND) diff --git a/vv/vvBlendImageActor.cxx b/vv/vvBlendImageActor.cxx index 2093c7d..4f47ecc 100644 --- a/vv/vvBlendImageActor.cxx +++ b/vv/vvBlendImageActor.cxx @@ -18,11 +18,18 @@ It is distributed under dual licence #include "vvBlendImageActor.h" + +#include +#ifdef VTKGL2 +#include "vtk_glew.h" +#else +#include "vtkOpenGLExtensionManager.h" +#include "vtkOpenGLExtensionManagerConfigure.h" +#include "vtkgl.h" +#endif #include -#include #include #include -#include #include vtkStandardNewMacro(vvBlendImageActor); @@ -40,6 +47,21 @@ void vvBlendImageActor::Render(vtkRenderer *ren) { //Change blending to maximum per component instead of weighted sum vtkOpenGLRenderWindow *renwin = dynamic_cast(ren->GetRenderWindow()); +#ifdef VTKGL2 + const char *extensions = renwin->ReportCapabilities(); + //if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) { + // extensions->LoadExtension("GL_EXT_blend_minmax"); + //glBlendEquationEXT( GL_MAX_EXT ); + //} + + //Call normal render + VTK_IMAGE_ACTOR::Render(ren); + + //Move back blending to weighted sum + if (glBlendEquationEXT!=0) { + glBlendEquationEXT( GL_FUNC_ADD_EXT ); + } +#else vtkOpenGLExtensionManager *extensions = renwin->GetExtensionManager(); if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) { extensions->LoadExtension("GL_EXT_blend_minmax"); @@ -53,6 +75,7 @@ void vvBlendImageActor::Render(vtkRenderer *ren) if (vtkgl::BlendEquationEXT!=0) { vtkgl::BlendEquationEXT( vtkgl::FUNC_ADD ); } +#endif } void vvBlendImageActor::PrintSelf(ostream& os, vtkIndent indent)