VTK
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 "vtkRenderingOpenGL2Module.h" // For export macro
31 #include "vtkPolyDataMapper2D.h"
32 #include "vtkNew.h" // used for ivars
33 #include "vtkOpenGLHelper.h" // used for ivars
34 #include <string> // For API.
35 #include <vector> //for ivars
36 
37 class vtkActor2D;
39 class vtkMatrix4x4;
41 class vtkOpenGLHelper;
43 class vtkPoints;
44 class vtkRenderer;
45 class vtkTextureObject;
46 class vtkTransform;
47 
48 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLPolyDataMapper2D : public vtkPolyDataMapper2D
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
54 
58  void RenderOverlay(vtkViewport* viewport, vtkActor2D* actor);
59 
66 
68  vtkGetObjectMacro(VBO,vtkOpenGLVertexBufferObject);
69 
70 protected:
73 
75 
76  // the following is all extra stuff to work around the
77  // fact that gl_PrimitiveID does not work correctly on
78  // Apple devices with AMD graphics hardware. See apple
79  // bug ID 20747550
81  std::vector<float> AppleBugPrimIDs;
83 
88  vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act);
89 
93  virtual void BuildShaders(std::string &VertexCode,
94  std::string &fragmentCode,
95  std::string &geometryCode,
96  vtkViewport *ren, vtkActor2D *act);
97 
101  virtual void UpdateShaders(vtkOpenGLHelper &cellBO,
102  vtkViewport *viewport, vtkActor2D *act);
103 
108 
109 
114 
119 
124  virtual void ReplaceShaderPicking(
125  std::string & fssource,
126  vtkRenderer *ren, vtkActor2D *act);
127 
131  void UpdateVBO(vtkActor2D *act, vtkViewport *viewport);
132 
133  // The VBO and its layout.
135 
136  // Structures for the various cell types we render.
142 
147 
148  vtkTimeStamp VBOUpdateTime; // When was the VBO updated?
152 
155 
156  // do we have wide lines that require special handling
158 
159 private:
160  vtkOpenGLPolyDataMapper2D(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
161  void operator=(const vtkOpenGLPolyDataMapper2D&) VTK_DELETE_FUNCTION;
162 };
163 
164 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
OpenGL buffer object.
2D PolyData support for OpenGL
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.
static vtkOpenGLPolyDataMapper2D * New()
std::vector< float > AppleBugPrimIDs
void UpdateVBO(vtkActor2D *act, vtkViewport *viewport)
Update the scene when necessary.
vtkOpenGLVertexBufferObject * VBO
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
virtual void ReplaceShaderPicking(std::string &fssource, vtkRenderer *ren, vtkActor2D *act)
Perform string replacments 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.
void RenderOverlay(vtkViewport *viewport, vtkActor2D *actor)
Actually draw the poly data.
vtkGenericOpenGLResourceFreeCallback * ResourceCallback
vtkNew< vtkTransform > VBOTransformInverse
vtkOpenGLBufferObject * AppleBugPrimIDBuffer
vtkOpenGLBufferObject * CellScalarBuffer
void SetCameraShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *viewport, vtkActor2D *act)
Set the shader parameteres related to the Camera.
vtkNew< vtkMatrix4x4 > VBOShiftScale
virtual void SetMapperShaderParameters(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act)
Set the shader parameteres related to the mapper/input data, called by UpdateShader.
virtual bool HaveWideLines(vtkViewport *, vtkActor2D *)
virtual bool GetNeedToRebuildShaders(vtkOpenGLHelper &cellBO, vtkViewport *ren, vtkActor2D *act)
Does the shader source need to be recomputed.
represent and manipulate 3D points
Definition: vtkPoints.h:40
draw vtkPolyData onto the image plane
abstract specification for renderers
Definition: vtkRenderer.h:64
abstracts an OpenGL texture object.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ string
Definition: vtkX3D.h:490