VTK
vtkOpenGLRenderer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLRenderer.h
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 =========================================================================*/
23 #ifndef vtkOpenGLRenderer_h
24 #define vtkOpenGLRenderer_h
25 
26 #include "vtkRenderingOpenGL2Module.h" // For export macro
27 #include "vtkRenderer.h"
28 #include <vector> // STL Header
29 #include <string> // Ivars
30 
32 class vtkRenderPass;
33 class vtkOpenGLState;
34 class vtkOpenGLTexture;
35 class vtkTextureObject;
37 class vtkShaderProgram;
38 class vtkShadowMapPass;
39 
40 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
41 {
42 public:
43  static vtkOpenGLRenderer *New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  void DeviceRender(void) override;
51 
55  void DeviceRenderOpaqueGeometry() override;
56 
64 
65  void Clear(void) override;
66 
70  int UpdateLights(void) override;
71 
78  int GetDepthPeelingHigherLayer();
79 
86  bool HaveApplePrimitiveIdBug();
87 
92  static bool HaveAppleQueryAllocationBug();
93 
99  bool IsDualDepthPeelingSupported();
100 
101  // Get the state object used to keep track of
102  // OpenGL state
103  vtkOpenGLState *GetState();
104 
105  // get the standard lighting uniform declarations
106  // for the current set of lights
107  const char *GetLightingUniforms();
108 
109  // update the lighting uniforms for this shader if they
110  // are out of date
111  void UpdateLightingUniforms(vtkShaderProgram *prog);
112 
113  // get the complexity of the current lights as a int
114  // 0 = no lighting
115  // 1 = headlight
116  // 2 = directional lights
117  // 3 = positional lights
119  NoLighting = 0,
120  Headlight = 1,
121  Directional = 2,
122  Positional = 3
123  };
124  vtkGetMacro(LightingComplexity, int);
125 
126  // get the number of lights turned on
127  vtkGetMacro(LightingCount, int);
128 
129 protected:
131  ~vtkOpenGLRenderer() override;
132 
136  void CheckCompilation(unsigned int fragmentShader);
137 
138  // Internal method to release graphics resources in any derived renderers.
139  void ReleaseGraphicsResources(vtkWindow *w) override;
140 
146  int UpdateGeometry() override;
147 
148  friend class vtkOpenGLProperty;
149  friend class vtkOpenGLTexture;
151  friend class vtkOpenGLImageResliceMapper;
152 
157 
162 
167 
168  // Is rendering at translucent geometry stage using depth peeling and
169  // rendering a layer other than the first one? (Boolean value)
170  // If so, the uniform variables UseTexture and Texture can be set.
171  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
173 
174  friend class vtkRenderPass;
175 
178 
183 
184 private:
185  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
186  void operator=(const vtkOpenGLRenderer&) = delete;
187 };
188 
189 #endif
Implement Depth Peeling for use within a framebuffer pass.
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
std::string LightingDeclaration
virtual int UpdateGeometry()
Ask all props to update and draw any opaque and translucent geometry.
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:869
abstract specification for renderers
Definition: vtkRenderer.h:57
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
OpenGL property.
OpenGL mapper for image slice display.
OpenGL texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
OpenGL state storage.
virtual void DeviceRender()=0
Create an image.
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void DeviceRenderTranslucentPolygonalGeometry()
Render translucent polygonal geometry.
virtual void DeviceRenderOpaqueGeometry()
Render opaque polygonal geometry.
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkMTimeType LightingUpdateTime
abstracts an OpenGL texture object.
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on,...
Implement a shadow mapping render pass.
Perform FXAA antialiasing on the current framebuffer.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:55
OpenGL renderer.
virtual void Clear()
Clear the image to the background color.
Definition: vtkRenderer.h:320
The ShaderProgram uses one or more Shader objects.