VTK  9.7.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
13
14#ifndef vtkOpenGLRenderer_h
15#define vtkOpenGLRenderer_h
16
17#include "vtkRenderer.h"
18
19#include "vtkOpenGLQuadHelper.h" // for ivar
20#include "vtkPBRIrradianceTexture.h" // for ivar
21#include "vtkPBRLUTTexture.h" // for ivar
22#include "vtkPBRPrefilterTexture.h" // for ivar
23#include "vtkRenderingOpenGL2Module.h" // For export macro
24#include "vtkSmartPointer.h" // For vtkSmartPointer
25#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26#include <string> // Ivars
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkFloatArray;
31class vtkRenderPass;
32class vtkOpenGLState;
39class vtkSSAOPass;
40class vtkPolyData;
44class vtkCameraPass;
46
47class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLRenderer : public vtkRenderer
48{
49public:
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
59 void DeviceRender() override;
60
65
73
74 void Clear() override;
75
79 int UpdateLights() override;
80
88
94
101
102 // Get the state object used to keep track of
103 // OpenGL state
105
106 // get the standard lighting uniform declarations
107 // for the current set of lights
108 const char* GetLightingUniforms();
109
110 // update the lighting uniforms for this shader if they
111 // are out of date
113
114 // get the complexity of the current lights as a int
115 // 0 = no lighting
116 // 1 = headlight
117 // 2 = directional lights
118 // 3 = positional lights
120 {
125 };
126 vtkGetMacro(LightingComplexity, int);
127
128 // get the number of lights turned on
129 vtkGetMacro(LightingCount, int);
130
132
139
141
144 vtkSetSmartPointerMacro(EnvMapLookupTable, vtkPBRLUTTexture);
146 vtkSetSmartPointerMacro(EnvMapIrradiance, vtkPBRIrradianceTexture);
148 vtkSetSmartPointerMacro(EnvMapPrefiltered, vtkPBRPrefilterTexture);
151
156
158
161 vtkSetMacro(UseSphericalHarmonics, bool);
162 vtkGetMacro(UseSphericalHarmonics, bool);
163 vtkBooleanMacro(UseSphericalHarmonics, bool);
165
180 void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
181
182 // Method to release graphics resources
184
185protected:
188
192 void CheckCompilation(unsigned int fragmentShader);
193
199 int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
200
207
208 friend class vtkOpenGLProperty;
209 friend class vtkOpenGLTexture;
212
217
222
227
232
237
238 // Is rendering at translucent geometry stage using depth peeling and
239 // rendering a layer other than the first one? (Boolean value)
240 // If so, the uniform variables UseTexture and Texture can be set.
241 // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
243
244 friend class vtkRenderPass;
245
250
255
261
266
267private:
268 vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
269 void operator=(const vtkOpenGLRenderer&) = delete;
270
276};
277
278#define vtkOpenGLRenderer_OVERRIDE_ATTRIBUTES vtkOpenGLRenderer::CreateOverrideAttributes()
279VTK_ABI_NAMESPACE_END
280#endif
Implement the camera render pass.
Implement Depth Peeling for use within a framebuffer pass.
dynamic, self-adjusting array of float
abstract interface to OpenGL FBOs
Screen space render pass that blur a given image using the hexagonal bokeh method.
a simple class to control print indentation
Definition vtkIndent.h:29
Perform FXAA antialiasing on the current framebuffer.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
vtkSmartPointer< vtkPBRIrradianceTexture > EnvMapIrradiance
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Set/Get the environment texture used for image based lighting.
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()
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
friend class vtkOpenGLImageResliceMapper
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkSmartPointer< vtkPBRLUTTexture > EnvMapLookupTable
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
friend class vtkRenderPass
static vtkOverrideAttribute * CreateOverrideAttributes()
vtkSmartPointer< vtkPBRPrefilterTexture > EnvMapPrefiltered
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()
vtkSmartPointer< vtkTexturedActor2D > BackgroundGradientActor
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.
friend class vtkOpenGLImageSliceMapper
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.
vtkSmartPointer< vtkPolyDataMapper2D > BackgroundMapper
friend class vtkOpenGLTexture
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void Clear() override
Clear the image to the background color.
vtkSmartPointer< vtkTexturedActor2D > BackgroundTextureActor
~vtkOpenGLRenderer() override
vtkSmartPointer< vtkPolyData > BackgroundQuad
friend class vtkOpenGLProperty
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.
Attribute for vtkObjectFactory overrides.
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
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:72
Perform part of the rendering of a vtkRenderer.
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:37
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
Hold a reference to a vtkObjectBase instance.
In case DepthTextureCompare is true, specify the comparison function in use.
handles properties associated with a texture map
Definition vtkTexture.h:59
actor that draws 2D data with texture support
describes linear transformations via a 4x4 matrix
window superclass for vtkRenderWindow
Definition vtkWindow.h:42
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_MARSHALAUTO
#define VTK_NEWINSTANCE