]> Creatis software - clitk.git/blob - vv/vvBlendImageActor.cxx
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvBlendImageActor.cxx
1 /*=========================================================================
2 Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4 Authors belong to:
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
8
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.
12
13 It is distributed under dual licence
14
15 - BSD        See included LICENSE.txt file
16 - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 #include "vvBlendImageActor.h"
20 #ifdef VTK_OPENGL2
21   #include <vtk_glew.h>
22 #else
23   #include <vtkgl.h>
24   #include <vtkOpenGLExtensionManager.h>
25 #endif
26 #include <vtkOpenGLRenderWindow.h>
27 #include <vtkOpenGLRenderer.h>
28 #include <vtkOpenGL.h>
29 #include <vtkObjectFactory.h>
30
31 vtkStandardNewMacro(vvBlendImageActor);
32
33 vvBlendImageActor::vvBlendImageActor()
34 {
35 }
36
37 vvBlendImageActor::~vvBlendImageActor()
38 {
39 }
40
41 // Actual actor render method.
42 void vvBlendImageActor::Render(vtkRenderer *ren)
43 {
44   //Change blending to maximum per component instead of weighted sum
45   vtkOpenGLRenderWindow *renwin = dynamic_cast<vtkOpenGLRenderWindow*>(ren->GetRenderWindow());
46 #ifdef VTK_OPENGL2
47   const char *extensions = renwin->ReportCapabilities();
48
49   //Call normal render
50   VTK_IMAGE_ACTOR::Render(ren);
51
52 #else
53   vtkOpenGLExtensionManager *extensions = renwin->GetExtensionManager();
54   if (extensions->ExtensionSupported("GL_EXT_blend_minmax")) {
55     extensions->LoadExtension("GL_EXT_blend_minmax");
56     vtkgl::BlendEquationEXT( vtkgl::MAX );
57   }
58
59   //Call normal render
60   VTK_IMAGE_ACTOR::Render(ren);
61
62   //Move back blending to weighted sum
63   if (vtkgl::BlendEquationEXT!=0) {
64     vtkgl::BlendEquationEXT( vtkgl::FUNC_ADD );
65   }
66 #endif
67 }
68
69 void vvBlendImageActor::PrintSelf(ostream& os, vtkIndent indent)
70 {
71   this->Superclass::PrintSelf(os,indent);
72 }