1 /*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkClearRGBPass.cxx
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14 =========================================================================*/
15
16 #include "vtkClearRGBPass.h"
17 #include "vtkObjectFactory.h"
18 #include "vtkRenderState.h"
19 #include "vtkOpenGLState.h"
20 #include "vtkOpenGLRenderer.h"
21 #include "vtk_glew.h"
22
23 vtkStandardNewMacro(vtkClearRGBPass);
24
25 // ----------------------------------------------------------------------------
vtkClearRGBPass()26 vtkClearRGBPass::vtkClearRGBPass()
27 {
28 this->Background[0] = 0;
29 this->Background[1] = 0;
30 this->Background[2] = 0;
31 }
32
33 // ----------------------------------------------------------------------------
34 vtkClearRGBPass::~vtkClearRGBPass() = default;
35
36 // ----------------------------------------------------------------------------
PrintSelf(ostream & os,vtkIndent indent)37 void vtkClearRGBPass::PrintSelf(ostream& os, vtkIndent indent)
38 {
39 this->Superclass::PrintSelf(os,indent);
40
41 os << indent << "Background:"
42 << this->Background[0] << "," << this->Background[1] << ","
43 << this->Background[2] << endl;
44 }
45
46 // ----------------------------------------------------------------------------
Render(const vtkRenderState * s)47 void vtkClearRGBPass::Render(const vtkRenderState *s)
48 {
49 this->NumberOfRenderedProps=0;
50
51 vtkOpenGLState *ostate =
52 static_cast<vtkOpenGLRenderer*>(s->GetRenderer())->GetState();
53 ostate->vtkglClearColor( static_cast<GLclampf>(this->Background[0]),
54 static_cast<GLclampf>(this->Background[1]),
55 static_cast<GLclampf>(this->Background[2]),
56 static_cast<GLclampf>(0.0));
57 ostate->vtkglClear(GL_COLOR_BUFFER_BIT);
58 }
59