1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
19 #include "vvBlendImageActor.h"
22 #include <vtkVersion.h>
26 #include "vtkOpenGLExtensionManager.h"
27 #include "vtkOpenGLExtensionManagerConfigure.h"
30 #include <vtkOpenGLRenderWindow.h>
31 #include <vtkOpenGLRenderer.h>
32 #include <vtkOpenGL.h>
33 #include <vtkObjectFactory.h>
35 vtkStandardNewMacro(vvBlendImageActor);
37 vvBlendImageActor::vvBlendImageActor()
41 vvBlendImageActor::~vvBlendImageActor()
45 // Actual actor render method.
46 void vvBlendImageActor::Render(vtkRenderer *ren)
48 //Change blending to maximum per component instead of weighted sum
49 vtkOpenGLRenderWindow *renwin = dynamic_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
51 const char *extensions = renwin->ReportCapabilities();
52 //if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) {
53 // extensions->LoadExtension("GL_EXT_blend_minmax");
54 //glBlendEquationEXT( GL_MAX_EXT );
58 VTK_IMAGE_ACTOR::Render(ren);
60 //Move back blending to weighted sum
61 if (glBlendEquationEXT!=0) {
62 glBlendEquationEXT( GL_FUNC_ADD_EXT );
65 vtkOpenGLExtensionManager *extensions = renwin->GetExtensionManager();
66 if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) {
67 extensions->LoadExtension("GL_EXT_blend_minmax");
68 vtkgl::BlendEquationEXT( vtkgl::MAX );
72 VTK_IMAGE_ACTOR::Render(ren);
74 //Move back blending to weighted sum
75 if (vtkgl::BlendEquationEXT!=0) {
76 vtkgl::BlendEquationEXT( vtkgl::FUNC_ADD );
81 void vvBlendImageActor::PrintSelf(ostream& os, vtkIndent indent)
83 this->Superclass::PrintSelf(os,indent);