VTK  9.1.0
vtkOpenGLPolyDataMapper2D.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOpenGLPolyDataMapper2D.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
27#ifndef vtkOpenGLPolyDataMapper2D_h
28#define vtkOpenGLPolyDataMapper2D_h
29
30#include "vtkNew.h" // used for ivars
31#include "vtkOpenGLHelper.h" // used for ivars
32#include "vtkPolyDataMapper2D.h"
33#include "vtkRenderingOpenGL2Module.h" // For export macro
34#include <map> //for used data arrays & vbos
35#include <string> // For API.
36#include <vector> //for ivars
37
38class vtkActor2D;
40class vtkMatrix4x4;
43class vtkOpenGLHelper;
45class vtkPoints;
46class vtkRenderer;
48class vtkTransform;
49
50class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
60 void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
61
68
69protected:
72
74
79
83 virtual void BuildShaders(std::string& VertexCode, std::string& fragmentCode,
84 std::string& geometryCode, vtkViewport* ren, vtkActor2D* act);
85
89 virtual void UpdateShaders(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
90
95 vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
96
101
106
111 virtual void ReplaceShaderPicking(std::string& fssource, vtkRenderer* ren, vtkActor2D* act);
112
116 void UpdateVBO(vtkActor2D* act, vtkViewport* viewport);
117
118 // The VBO and its layout.
120
121 // Structures for the various cell types we render.
127
132
133 vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
137
140
141 // do we have wide lines that require special handling
143
144 // stores the mapping from vtk cells to gl_PrimitiveId
146
147private:
149 void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
150};
151
152#endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
Allocate and hold a VTK object.
Definition: vtkNew.h:165
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 parameteres related to the property.
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 parameteres related to the mapper/input data, called by UpdateShader.
vtkOpenGLBufferObject * CellScalarBuffer
void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameteres 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:143
draw vtkPolyData onto the image plane
abstract specification for renderers
Definition: vtkRenderer.h:182
abstracts an OpenGL texture object.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39