VTK  9.3.20240329
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
15 #ifndef vtkOpenGLPolyDataMapper2D_h
16 #define vtkOpenGLPolyDataMapper2D_h
17 
18 #include "vtkNew.h" // used for ivars
19 #include "vtkOpenGLHelper.h" // used for ivars
20 #include "vtkPolyDataMapper2D.h"
21 #include "vtkRenderingOpenGL2Module.h" // For export macro
22 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23 #include <map> //for used data arrays & vbos
24 #include <string> // For API.
25 #include <vector> //for ivars
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkActor2D;
30 class vtkMatrix4x4;
33 class vtkOpenGLHelper;
35 class vtkPoints;
36 class vtkRenderer;
37 class vtkTextureObject;
38 class vtkTransform;
39 
40 class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper2D
41  : public vtkPolyDataMapper2D
42 {
43 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
52 
59 
60 protected:
63 
65 
70 
74  virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
75  std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
76 
80  virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
81 
86  vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
87 
92 
97 
102  virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
103 
107  void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
108 
109  // The VBO and its layout.
111 
112  // Structures for the various cell types we render.
118 
123 
124  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
128 
131 
132  // do we have wide lines that require special handling
134 
135  // stores the mapping from vtk cells to gl_PrimitiveId
137 
138 private:
140  void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
141 };
142 
143 VTK_ABI_NAMESPACE_END
144 #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
Definition: vtkMatrix4x4.h:141
OpenGL buffer object.
OpenGL rendering utility functions.
2D PolyData support for OpenGL
~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.
static vtkOpenGLPolyDataMapper2D * New()
void UpdateVBO(vtkActor2D *act, vtkViewport *viewport)
Update the scene when necessary.
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
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the mapper/input data, called by UpdateShader.
vtkOpenGLBufferObject * CellScalarBuffer
void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameters related to the Camera.
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
vtkNew< vtkMatrix4x4 > VBOShiftScale
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
represent and manipulate 3D points
Definition: vtkPoints.h:139
draw vtkPolyData onto the image plane
abstract specification for renderers
Definition: vtkRenderer.h:172
abstracts an OpenGL texture object.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:160
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ string
Definition: vtkX3D.h:490
#define VTK_MARSHALAUTO