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 =========================================================================*/
135 #ifndef vtkOpenGLRenderer_h
136 #define vtkOpenGLRenderer_h
137 
138 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_1_0
139 #include "vtkRenderer.h"
140 #include "vtkRenderingOpenGL2Module.h" // For export macro
141 #include "vtkSmartPointer.h" // For vtkSmartPointer
142 #include <string> // Ivars
143 #include <vector> // STL Header
144 
145 class vtkFloatArray;
146 class vtkOpenGLFXAAFilter;
147 class vtkRenderPass;
148 class vtkOpenGLState;
149 class vtkOpenGLTexture;
151 class vtkTextureObject;
152 class vtkDepthPeelingPass;
154 class vtkPBRLUTTexture;
156 class vtkShaderProgram;
157 class vtkShadowMapPass;
158 class vtkSSAOPass;
159 
160 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
161 {
162 public:
165  void PrintSelf(ostream& os, vtkIndent indent) override;
166 
170  void DeviceRender(void) override;
171 
176 
184 
185  void Clear(void) override;
186 
190  int UpdateLights(void) override;
191 
199 
207  "Removed in 9.1.0 as this bug does not affect any macOS release that VTK supports")
208  bool HaveApplePrimitiveIdBug();
209 
214  static bool HaveAppleQueryAllocationBug();
215 
221  bool IsDualDepthPeelingSupported();
222 
223  // Get the state object used to keep track of
224  // OpenGL state
225  vtkOpenGLState* GetState();
226 
227  // get the standard lighting uniform declarations
228  // for the current set of lights
229  const char* GetLightingUniforms();
230 
231  // update the lighting uniforms for this shader if they
232  // are out of date
233  void UpdateLightingUniforms(vtkShaderProgram* prog);
234 
235  // get the complexity of the current lights as a int
236  // 0 = no lighting
237  // 1 = headlight
238  // 2 = directional lights
239  // 3 = positional lights
241  {
242  NoLighting = 0,
243  Headlight = 1,
244  Directional = 2,
245  Positional = 3
246  };
247  vtkGetMacro(LightingComplexity, int);
248 
249  // get the number of lights turned on
250  vtkGetMacro(LightingCount, int);
251 
253 
260 
262 
269 
274 
276 
279  vtkSetMacro(UseSphericalHarmonics, bool);
280  vtkGetMacro(UseSphericalHarmonics, bool);
281  vtkBooleanMacro(UseSphericalHarmonics, bool);
283 
287  void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
288 
289  // Method to release graphics resources
291 
292 protected:
294  ~vtkOpenGLRenderer() override;
295 
299  void CheckCompilation(unsigned int fragmentShader);
300 
306  int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
307 
314 
315  friend class vtkOpenGLProperty;
316  friend class vtkOpenGLTexture;
318  friend class vtkOpenGLImageResliceMapper;
319 
324 
329 
334 
339 
344 
345  // Is rendering at translucent geometry stage using depth peeling and
346  // rendering a layer other than the first one? (Boolean value)
347  // If so, the uniform variables UseTexture and Texture can be set.
348  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
350 
351  friend class vtkRenderPass;
352 
357 
362 
368 
369 private:
370  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
371  void operator=(const vtkOpenGLRenderer&) = delete;
372 };
373 
374 #endif
Implement Depth Peeling for use within a framebuffer pass.
dynamic, self-adjusting array of float
abstract interface to OpenGL FBOs
a simple class to control print indentation
Definition: vtkIndent.h:119
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPBRPrefilterTexture * EnvMapPrefiltered
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Overridden in order to connect the texture to the environment map textures.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
Get environment textures used for image based lighting.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkPBRIrradianceTexture * EnvMapIrradiance
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkPBRLUTTexture * EnvMapLookupTable
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
void Clear(void) override
Clear the image to the background color.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
int UpdateLights(void) override
Ask lights to load themselves into graphics pipeline.
static vtkOpenGLRenderer * New()
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
void DeviceRender(void) override
Concrete open gl render method.
~vtkOpenGLRenderer() override
void CheckCompilation(unsigned int fragmentShader)
Check the compilation status of some fragment shader source.
int GetDepthPeelingHigherLayer()
Is rendering at translucent geometry stage using depth peeling and rendering a layer other than the f...
OpenGL state storage.
OpenGL texture map.
Implement OIT rendering using average color.
precompute irradiance texture used in physically based rendering
precompute BRDF look-up table texture used in physically based rendering
precompute prefilter texture used in physically based rendering
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:60
abstract specification for renderers
Definition: vtkRenderer.h:182
Implement a screen-space ambient occlusion pass.
Definition: vtkSSAOPass.h:46
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition: vtkTexture.h:178
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ string
Definition: vtkX3D.h:496
#define VTK_DEPRECATED_IN_9_1_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287