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"
21 #include <vtkOpenGLRenderWindow.h>
22 #include <vtkOpenGLExtensionManager.h>
23 #include <vtkOpenGLRenderer.h>
24 #include <vtkOpenGL.h>
26 #include <vtkObjectFactory.h>
28 vtkStandardNewMacro(vvBlendImageActor);
30 vvBlendImageActor::vvBlendImageActor()
34 vvBlendImageActor::~vvBlendImageActor()
38 // Actual actor render method.
39 void vvBlendImageActor::Render(vtkRenderer *ren)
41 //Change blending to maximum per component instead of weighted sum
42 vtkOpenGLRenderWindow *renwin = dynamic_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
43 vtkOpenGLExtensionManager *extensions = renwin->GetExtensionManager();
44 if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) {
45 extensions->LoadExtension("GL_EXT_blend_minmax");
46 vtkgl::BlendEquationEXT( vtkgl::MAX );
50 vtkOpenGLImageActor::Render(ren);
52 //Move back blending to weighted sum
53 if (vtkgl::BlendEquationEXT!=0) {
54 vtkgl::BlendEquationEXT( vtkgl::FUNC_ADD );
58 void vvBlendImageActor::PrintSelf(ostream& os, vtkIndent indent)
60 this->Superclass::PrintSelf(os,indent);