VTK  9.4.20250206
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
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;
42
43class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkOpenGLPolyDataMapper2D
44 : public vtkPolyDataMapper2D
45{
46public:
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
54 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
55
62
63protected:
66
68
73
77 virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
78 std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
79
83 virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
84
88 virtual void SetCustomUniforms(vtkOpenGLHelper& cellBO, vtkActor2D* actor);
89
94 vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
95
100
105
110 virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
111
115 void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
116
117 // The VBO and its layout.
119
120 // Structures for the various cell types we render.
126
131
132 vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
136
139
140 // do we have wide lines that require special handling
142
143 // stores the mapping from vtk cells to gl_PrimitiveId
145
146private:
148 void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
149};
150
151VTK_ABI_NAMESPACE_END
152#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.
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.
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
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
represent and manipulate 3D points
Definition vtkPoints.h:139
draw vtkPolyData onto the image plane
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:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define VTK_MARSHALAUTO