From: tbaudier Date: Fri, 6 Oct 2017 08:40:16 +0000 (+0200) Subject: Update to OpenGL2 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=58f6f4201ec9091b5150f6576da25bfedeabbdce;p=clitk.git Update to OpenGL2 --- diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index a20b0b0..fe6120e 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -9,6 +9,12 @@ endif(COMMAND cmake_policy) #========================================================= OPTION(CLITK_USE_PACS_CONNECTION "USE PACS CONNECTION" OFF) #========================================================= + +# Look for OpenGL2 version +if (VTK_RENDERING_BACKEND STREQUAL "OpenGL2") + add_definitions(-DVTK_OPENGL2) +endif () + #List of vv tools to compile set(vv_TOOLS vvToolMedianFilter diff --git a/vv/vvBlendImageActor.cxx b/vv/vvBlendImageActor.cxx index 2093c7d..24434d1 100644 --- a/vv/vvBlendImageActor.cxx +++ b/vv/vvBlendImageActor.cxx @@ -17,12 +17,14 @@ It is distributed under dual licence ===========================================================================**/ #include "vvBlendImageActor.h" - +#ifdef VTK_OPENGL2 + #include +#else + #include +#endif #include -#include #include #include -#include #include vtkStandardNewMacro(vvBlendImageActor); @@ -40,6 +42,13 @@ void vvBlendImageActor::Render(vtkRenderer *ren) { //Change blending to maximum per component instead of weighted sum vtkOpenGLRenderWindow *renwin = dynamic_cast(ren->GetRenderWindow()); +#ifdef VTK_OPENGL2 + const char *extensions = renwin->ReportCapabilities(); + + //Call normal render + VTK_IMAGE_ACTOR::Render(ren); + +#else vtkOpenGLExtensionManager *extensions = renwin->GetExtensionManager(); if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) { extensions->LoadExtension("GL_EXT_blend_minmax"); @@ -53,6 +62,7 @@ void vvBlendImageActor::Render(vtkRenderer *ren) if (vtkgl::BlendEquationEXT!=0) { vtkgl::BlendEquationEXT( vtkgl::FUNC_ADD ); } +#endif } void vvBlendImageActor::PrintSelf(ostream& os, vtkIndent indent)