VTK  9.2.6
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 =========================================================================*/
26 #ifndef vtkOpenGLRenderer_h
27 #define vtkOpenGLRenderer_h
28 
29 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_1_0
30 #include "vtkRenderer.h"
31 #include "vtkRenderingOpenGL2Module.h" // For export macro
32 #include "vtkSmartPointer.h" // For vtkSmartPointer
33 #include <string> // Ivars
34 #include <vector> // STL Header
35 
36 class vtkFloatArray;
38 class vtkRenderPass;
39 class vtkOpenGLState;
40 class vtkOpenGLTexture;
42 class vtkTextureObject;
45 class vtkPBRLUTTexture;
47 class vtkShaderProgram;
48 class vtkShadowMapPass;
49 class vtkSSAOPass;
50 
51 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
52 {
53 public:
54  static vtkOpenGLRenderer* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  void DeviceRender(void) override;
62 
66  void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
67 
75 
76  void Clear(void) override;
77 
81  int UpdateLights(void) override;
82 
89  int GetDepthPeelingHigherLayer();
90 
98  "Removed in 9.1.0 as this bug does not affect any macOS release that VTK supports")
99  bool HaveApplePrimitiveIdBug();
100 
105  static bool HaveAppleQueryAllocationBug();
106 
112  bool IsDualDepthPeelingSupported();
113 
114  // Get the state object used to keep track of
115  // OpenGL state
116  vtkOpenGLState* GetState();
117 
118  // get the standard lighting uniform declarations
119  // for the current set of lights
120  const char* GetLightingUniforms();
121 
122  // update the lighting uniforms for this shader if they
123  // are out of date
124  void UpdateLightingUniforms(vtkShaderProgram* prog);
125 
126  // get the complexity of the current lights as a int
127  // 0 = no lighting
128  // 1 = headlight
129  // 2 = directional lights
130  // 3 = positional lights
132  {
133  NoLighting = 0,
134  Headlight = 1,
135  Directional = 2,
136  Positional = 3
137  };
138  vtkGetMacro(LightingComplexity, int);
139 
140  // get the number of lights turned on
141  vtkGetMacro(LightingCount, int);
142 
144 
148  void SetUserLightTransform(vtkTransform* transform);
149  vtkTransform* GetUserLightTransform();
151 
153 
156  vtkPBRLUTTexture* GetEnvMapLookupTable();
157  vtkPBRIrradianceTexture* GetEnvMapIrradiance();
158  vtkPBRPrefilterTexture* GetEnvMapPrefiltered();
160 
164  vtkFloatArray* GetSphericalHarmonics();
165 
167 
170  vtkSetMacro(UseSphericalHarmonics, bool);
171  vtkGetMacro(UseSphericalHarmonics, bool);
172  vtkBooleanMacro(UseSphericalHarmonics, bool);
174 
178  void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
179 
180  // Method to release graphics resources
181  void ReleaseGraphicsResources(vtkWindow* w) override;
182 
183 protected:
185  ~vtkOpenGLRenderer() override;
186 
190  void CheckCompilation(unsigned int fragmentShader);
191 
197  int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
198 
204  vtkTexture* GetCurrentTexturedBackground();
205 
206  friend class vtkOpenGLProperty;
207  friend class vtkOpenGLTexture;
209  friend class vtkOpenGLImageResliceMapper;
210 
215 
220 
225 
230 
235 
236  // Is rendering at translucent geometry stage using depth peeling and
237  // rendering a layer other than the first one? (Boolean value)
238  // If so, the uniform variables UseTexture and Texture can be set.
239  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
241 
242  friend class vtkRenderPass;
243 
248 
253 
259 
260 private:
261  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
262  void operator=(const vtkOpenGLRenderer&) = delete;
263 };
264 
265 #endif
Implement Depth Peeling for use within a framebuffer pass.
#define VTK_DEPRECATED_IN_9_1_0(reason)
Implement a screen-space ambient occlusion pass.
Definition: vtkSSAOPass.h:45
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkPBRIrradianceTexture * EnvMapIrradiance
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
std::string LightingDeclaration
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:1053
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
abstract specification for renderers
Definition: vtkRenderer.h:72
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
virtual void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false)
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.
vtkPBRLUTTexture * EnvMapLookupTable
OpenGL texture map.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
abstract interface to OpenGL FBOs
OpenGL state storage.
a simple class to control print indentation
Definition: vtkIndent.h:39
precompute prefilter texture used in physically based rendering
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
handles properties associated with a texture map
Definition: vtkTexture.h:68
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
virtual int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr)
Ask all props to update and draw any opaque and translucent geometry.
precompute BRDF look-up table texture used in physically based rendering
vtkMTimeType LightingUpdateTime
abstracts an OpenGL texture object.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
virtual void DeviceRender()
Create an image.
Definition: vtkRenderer.h:305
virtual void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr)
Render translucent polygonal geometry.
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.
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:59
OpenGL renderer.
vtkPBRPrefilterTexture * EnvMapPrefiltered
virtual void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr)
Render opaque polygonal geometry.
precompute irradiance texture used in physically based rendering
Implement OIT rendering using average color.
virtual void Clear()
Clear the image to the background color.
Definition: vtkRenderer.h:335
The ShaderProgram uses one or more Shader objects.