VTK  9.0.1
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 "vtkRenderer.h"
27 #include "vtkRenderingOpenGL2Module.h" // For export macro
28 #include "vtkSmartPointer.h" // For vtkSmartPointer
29 #include <string> // Ivars
30 #include <vector> // STL Header
31 
33 class vtkRenderPass;
34 class vtkOpenGLState;
35 class vtkOpenGLTexture;
37 class vtkTextureObject;
40 class vtkPBRLUTTexture;
42 class vtkShaderProgram;
43 class vtkShadowMapPass;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
46 {
47 public:
48  static vtkOpenGLRenderer* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void DeviceRender(void) override;
56 
60  void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
61 
69 
70  void Clear(void) override;
71 
75  int UpdateLights(void) override;
76 
83  int GetDepthPeelingHigherLayer();
84 
91  bool HaveApplePrimitiveIdBug();
92 
97  static bool HaveAppleQueryAllocationBug();
98 
104  bool IsDualDepthPeelingSupported();
105 
106  // Get the state object used to keep track of
107  // OpenGL state
108  vtkOpenGLState* GetState();
109 
110  // get the standard lighting uniform declarations
111  // for the current set of lights
112  const char* GetLightingUniforms();
113 
114  // update the lighting uniforms for this shader if they
115  // are out of date
116  void UpdateLightingUniforms(vtkShaderProgram* prog);
117 
118  // get the complexity of the current lights as a int
119  // 0 = no lighting
120  // 1 = headlight
121  // 2 = directional lights
122  // 3 = positional lights
124  {
125  NoLighting = 0,
126  Headlight = 1,
127  Directional = 2,
128  Positional = 3
129  };
130  vtkGetMacro(LightingComplexity, int);
131 
132  // get the number of lights turned on
133  vtkGetMacro(LightingCount, int);
134 
136 
140  void SetUserLightTransform(vtkTransform* transform);
141  vtkTransform* GetUserLightTransform();
143 
145 
148  vtkPBRLUTTexture* GetEnvMapLookupTable();
149  vtkPBRIrradianceTexture* GetEnvMapIrradiance();
150  vtkPBRPrefilterTexture* GetEnvMapPrefiltered();
152 
156  void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
157 
158  // Method to release graphics resources
159  void ReleaseGraphicsResources(vtkWindow* w) override;
160 
161 protected:
163  ~vtkOpenGLRenderer() override;
164 
168  void CheckCompilation(unsigned int fragmentShader);
169 
175  int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
176 
182  vtkTexture* GetCurrentTexturedBackground();
183 
184  friend class vtkOpenGLProperty;
185  friend class vtkOpenGLTexture;
187  friend class vtkOpenGLImageResliceMapper;
188 
193 
198 
203 
208 
209  // Is rendering at translucent geometry stage using depth peeling and
210  // rendering a layer other than the first one? (Boolean value)
211  // If so, the uniform variables UseTexture and Texture can be set.
212  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
214 
215  friend class vtkRenderPass;
216 
221 
226 
230 
231 private:
232  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
233  void operator=(const vtkOpenGLRenderer&) = delete;
234 };
235 
236 #endif
Implement Depth Peeling for use within a framebuffer pass.
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkPBRIrradianceTexture * EnvMapIrradiance
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
std::string LightingDeclaration
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:932
abstract specification for renderers
Definition: vtkRenderer.h:67
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
virtual void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false)
Set/Get the environment texture used for image based lighting.
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:37
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
abstract interface to OpenGL FBOs
OpenGL state storage.
a simple class to control print indentation
Definition: vtkIndent.h:33
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:65
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:300
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.
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:56
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:330
The ShaderProgram uses one or more Shader objects.