VTK  9.3.0
vtkOpenGLRenderer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
14#ifndef vtkOpenGLRenderer_h
15#define vtkOpenGLRenderer_h
16
17#include "vtkRenderer.h"
18
19#include "vtkOpenGLQuadHelper.h" // for ivar
20#include "vtkRenderingOpenGL2Module.h" // For export macro
21#include "vtkSmartPointer.h" // For vtkSmartPointer
22#include <memory> // for unique_ptr
23#include <string> // Ivars
24#include <vector> // STL Header
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkFloatArray;
29class vtkRenderPass;
30class vtkOpenGLState;
40class vtkSSAOPass;
41
42class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
43{
44public:
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
52 void DeviceRender() override;
53
58
66
67 void Clear() override;
68
72 int UpdateLights() override;
73
81
87
94
95 // Get the state object used to keep track of
96 // OpenGL state
98
99 // get the standard lighting uniform declarations
100 // for the current set of lights
101 const char* GetLightingUniforms();
102
103 // update the lighting uniforms for this shader if they
104 // are out of date
106
107 // get the complexity of the current lights as a int
108 // 0 = no lighting
109 // 1 = headlight
110 // 2 = directional lights
111 // 3 = positional lights
113 {
114 NoLighting = 0,
115 Headlight = 1,
116 Directional = 2,
117 Positional = 3
118 };
119 vtkGetMacro(LightingComplexity, int);
120
121 // get the number of lights turned on
122 vtkGetMacro(LightingCount, int);
123
125
132
134
141
146
148
151 vtkSetMacro(UseSphericalHarmonics, bool);
152 vtkGetMacro(UseSphericalHarmonics, bool);
153 vtkBooleanMacro(UseSphericalHarmonics, bool);
155
159 void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
160
161 // Method to release graphics resources
163
164protected:
167
171 void CheckCompilation(unsigned int fragmentShader);
172
178 int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
179
186
187 friend class vtkOpenGLProperty;
188 friend class vtkOpenGLTexture;
190 friend class vtkOpenGLImageResliceMapper;
191
196
201
206
211
216
217 // Is rendering at translucent geometry stage using depth peeling and
218 // rendering a layer other than the first one? (Boolean value)
219 // If so, the uniform variables UseTexture and Texture can be set.
220 // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
222
223 friend class vtkRenderPass;
224
229
234
239 std::unique_ptr<vtkOpenGLQuadHelper> BackgroundRenderer;
241
242private:
243 vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
244 void operator=(const vtkOpenGLRenderer&) = delete;
245};
246
247VTK_ABI_NAMESPACE_END
248#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:29
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
std::unique_ptr< vtkOpenGLQuadHelper > BackgroundRenderer
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.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkOpenGLState * GetState()
vtkPBRIrradianceTexture * EnvMapIrradiance
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkPBRLUTTexture * EnvMapLookupTable
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
const char * GetLightingUniforms()
int UpdateLights() override
Ask lights to load themselves into graphics pipeline.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
static vtkOpenGLRenderer * New()
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
void DeviceRender() override
Concrete open gl render method.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
Get environment textures used for image based lighting.
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
void UpdateLightingUniforms(vtkShaderProgram *prog)
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void Clear() override
Clear the image to the background color.
~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.
abstract specification for renderers
Definition vtkRenderer.h:59
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:35
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
Hold a reference to a vtkObjectBase instance.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition vtkTexture.h:58
describes linear transformations via a 4x4 matrix
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270