VTK  9.0.1
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 
38 class vtkActor2D;
40 class vtkMatrix4x4;
43 class vtkOpenGLHelper;
45 class vtkPoints;
46 class vtkRenderer;
47 class vtkTextureObject;
48 class vtkTransform;
49 
50 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D
51 {
52 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
60  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor) override;
61 
67  void ReleaseGraphicsResources(vtkWindow*) override;
68 
69 protected:
71  ~vtkOpenGLPolyDataMapper2D() override;
72 
74 
78  virtual bool GetNeedToRebuildShaders(vtkOpenGLHelper& cellBO, vtkViewport* ren, vtkActor2D* act);
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 
94  virtual void SetMapperShaderParameters(
95  vtkOpenGLHelper& cellBO, vtkViewport* ren, vtkActor2D* act);
96 
100  void SetCameraShaderParameters(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
101 
105  void SetPropertyShaderParameters(vtkOpenGLHelper& cellBO, vtkViewport* viewport, vtkActor2D* act);
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
142  virtual bool HaveWideLines(vtkViewport*, vtkActor2D*);
143 
144  // stores the mapping from vtk cells to gl_PrimitiveId
146 
147 private:
149  void operator=(const vtkOpenGLPolyDataMapper2D&) = delete;
150 };
151 
152 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkOpenGLPolyDataMapper2D::CellScalarBuffer
vtkOpenGLBufferObject * CellScalarBuffer
Definition: vtkOpenGLPolyDataMapper2D.h:129
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:44
vtkMapper2D::RenderOverlay
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
vtkOpenGLBufferObject
OpenGL buffer object.
Definition: vtkOpenGLBufferObject.h:33
vtkOpenGLPolyDataMapper2D::PickStateChanged
vtkTimeStamp PickStateChanged
Definition: vtkOpenGLPolyDataMapper2D.h:139
vtkOpenGLPolyDataMapper2D::LastBoundBO
vtkOpenGLHelper * LastBoundBO
Definition: vtkOpenGLPolyDataMapper2D.h:126
vtkOpenGLPolyDataMapper2D::TransformedPoints
vtkPoints * TransformedPoints
Definition: vtkOpenGLPolyDataMapper2D.h:134
vtkOpenGLPolyDataMapper2D::ResourceCallback
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
Definition: vtkOpenGLPolyDataMapper2D.h:73
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkOpenGLPolyDataMapper2D::LastPickState
int LastPickState
Definition: vtkOpenGLPolyDataMapper2D.h:138
vtkOpenGLHelper.h
vtkOpenGLPolyDataMapper2D::CellScalarTexture
vtkTextureObject * CellScalarTexture
Definition: vtkOpenGLPolyDataMapper2D.h:128
vtkPolyDataMapper2D::New
static vtkPolyDataMapper2D * New()
vtkOpenGLPolyDataMapper2D::Tris
vtkOpenGLHelper Tris
Definition: vtkOpenGLPolyDataMapper2D.h:124
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkOpenGLCellToVTKCellMap
OpenGL rendering utility functions.
Definition: vtkOpenGLCellToVTKCellMap.h:35
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkOpenGLPolyDataMapper2D::Points
vtkOpenGLHelper Points
Definition: vtkOpenGLPolyDataMapper2D.h:122
vtkOpenGLPolyDataMapper2D::CellCellMap
vtkNew< vtkOpenGLCellToVTKCellMap > CellCellMap
Definition: vtkOpenGLPolyDataMapper2D.h:145
vtkOpenGLVertexBufferObjectGroup
manage vertex buffer objects shared within a mapper
Definition: vtkOpenGLVertexBufferObjectGroup.h:77
vtkPolyDataMapper2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGenericOpenGLResourceFreeCallback
Definition: vtkOpenGLResourceFreeCallback.h:25
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkOpenGLPolyDataMapper2D::VBOs
vtkOpenGLVertexBufferObjectGroup * VBOs
Definition: vtkOpenGLPolyDataMapper2D.h:119
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkOpenGLPolyDataMapper2D::PrimitiveIDOffset
int PrimitiveIDOffset
Definition: vtkOpenGLPolyDataMapper2D.h:131
vtkOpenGLPolyDataMapper2D::VBOTransformInverse
vtkNew< vtkTransform > VBOTransformInverse
Definition: vtkOpenGLPolyDataMapper2D.h:135
vtkNew< vtkTransform >
vtkOpenGLPolyDataMapper2D
2D PolyData support for OpenGL
Definition: vtkOpenGLPolyDataMapper2D.h:50
vtkAbstractMapper::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
Definition: vtkAbstractMapper.h:68
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkNew.h
vtkOpenGLPolyDataMapper2D::TriStrips
vtkOpenGLHelper TriStrips
Definition: vtkOpenGLPolyDataMapper2D.h:125
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkOpenGLPolyDataMapper2D::Lines
vtkOpenGLHelper Lines
Definition: vtkOpenGLPolyDataMapper2D.h:123
vtkOpenGLPolyDataMapper2D::HaveCellScalars
bool HaveCellScalars
Definition: vtkOpenGLPolyDataMapper2D.h:130
vtkOpenGLPolyDataMapper2D::VBOShiftScale
vtkNew< vtkMatrix4x4 > VBOShiftScale
Definition: vtkOpenGLPolyDataMapper2D.h:136
vtkPolyDataMapper2D.h
vtkOpenGLPolyDataMapper2D::VBOUpdateTime
vtkTimeStamp VBOUpdateTime
Definition: vtkOpenGLPolyDataMapper2D.h:133