VTK  9.6.20260313
vtkOpenGLPolyDataMapper2D.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
17
18#ifndef vtkOpenGLPolyDataMapper2D_h
19#define vtkOpenGLPolyDataMapper2D_h
20
21#include "vtkNew.h" // used for ivars
22#include "vtkOpenGLHelper.h" // used for ivars
23#include "vtkPolyDataMapper2D.h"
24#include "vtkRenderingOpenGL2Module.h" // For export macro
25#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
26#include <map> //for used data arrays & vbos
27#include <string> // For API.
28#include <vector> //for ivars
29
30VTK_ABI_NAMESPACE_BEGIN
31class vtkActor2D;
33class vtkMatrix4x4;
36class vtkOpenGLHelper;
38class vtkPoints;
39class vtkRenderer;
41class vtkTransform;
43
44class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper2D
45 : public vtkPolyDataMapper2D
46{
47public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
57 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
58
65
66protected:
69
71
76
80 virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
81 std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
82
86 virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
87
91 virtual void SetCustomUniforms(vtkOpenGLHelper& cellBO, vtkActor2D* actor);
92
97 vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
98
103
108
113 virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
114
118 void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
119
120 // The VBO and its layout.
122
123 // Structures for the various cell types we render.
129
134
135 vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
139
142
143 // do we have wide lines that require special handling
145
146 // stores the mapping from vtk cells to gl_PrimitiveId
148
149private:
151 void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
152};
153
154#define vtkOpenGLPolyDataMapper2D_OVERRIDE_ATTRIBUTES \
155 vtkOpenGLPolyDataMapper2D::CreateOverrideAttributes()
156VTK_ABI_NAMESPACE_END
157#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:167
OpenGL buffer object.
OpenGL rendering utility functions.
~vtkOpenGLPolyDataMapper2D() override
virtual void BuildShaders(std::string &VertexCode, std::string &fragmentCode, std::string &geometryCode, vtkViewport *ren, vtkActor2D *act)
Build the shader source code.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetPropertyShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the property.
virtual void SetCustomUniforms(vtkOpenGLHelper &cellBO, vtkActor2D *actor)
Set the value of user-defined uniform variables, called by UpdateShaders.
void UpdateVBO(vtkActor2D *act, vtkViewport *viewport)
Update the scene when necessary.
static vtkOpenGLPolyDataMapper2D * New()
virtual void ReplaceShaderPicking(std::string &fssource, vtkRenderer *ren, vtkActor2D *act)
Perform string replacements on the shader templates, called from ReplaceShaderValues.
virtual void UpdateShaders(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Determine what shader to use and compile/link it.
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor) override
Actually draw the poly data.
vtkNew< vtkTransform > VBOTransformInverse
static vtkOverrideAttribute * CreateOverrideAttributes()
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the mapper/input data, called by UpdateShaders.
vtkOpenGLBufferObject * CellScalarBuffer
void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the Camera.
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
vtkOpenGLVertexBufferObjectGroup * VBOs
virtual bool HaveWideLines(vtkViewport *, vtkActor2D *)
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
virtual bool GetNeedToRebuildShaders(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act)
Does the shader source need to be recomputed.
manage vertex buffer objects shared within a mapper
Attribute for vtkObjectFactory overrides.
represent and manipulate 3D points
Definition vtkPoints.h:140
abstract specification for renderers
abstracts an OpenGL texture object.
record modification and/or execution time
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:61
#define VTK_MARSHALAUTO
#define VTK_NEWINSTANCE