VTK  9.0.20200808
vtkOpenGLVertexBufferObjectGroup.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLTexture.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 =========================================================================*/
60 #ifndef vtkOpenGLVertexBufferObjectGroup_h
61 #define vtkOpenGLVertexBufferObjectGroup_h
62 
63 #include "vtkObject.h"
64 #include "vtkRenderingOpenGL2Module.h" // For export macro
65 #include <map> // for methods
66 #include <string> // for ivars
67 #include <vector> // for ivars
68 
69 class vtkDataArray;
73 class vtkShaderProgram;
74 class vtkViewport;
75 class vtkWindow;
76 
77 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexBufferObjectGroup : public vtkObject
78 {
79 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
88  int GetNumberOfComponents(const char* attribute);
89 
94  int GetNumberOfTuples(const char* attribute);
95 
101  void ReleaseGraphicsResources(vtkWindow*);
102 
107  vtkOpenGLVertexBufferObject* GetVBO(const char* attribute);
108 
112  void AddAllAttributesToVAO(vtkShaderProgram* program, vtkOpenGLVertexArrayObject* vao);
113 
119  void RemoveAttribute(const char* attribute);
120 
126  void CacheDataArray(
127  const char* attribute, vtkDataArray* da, vtkOpenGLVertexBufferObjectCache* cache, int destType);
128  void CacheDataArray(const char* attribute, vtkDataArray* da, vtkViewport* vp, int destType);
129 
136  bool ArrayExists(
137  const char* attribute, vtkDataArray* da, vtkIdType& offset, vtkIdType& totalOffset);
138 
143  void AppendDataArray(const char* attribute, vtkDataArray* da, int destType);
144 
150  void BuildAllVBOs(vtkOpenGLVertexBufferObjectCache*);
151  void BuildAllVBOs(vtkViewport*);
152 
158  void ClearAllVBOs();
159 
165  void ClearAllDataArrays();
166 
170  vtkMTimeType GetMTime() override;
171 
172 protected:
175 
176  std::map<std::string, vtkOpenGLVertexBufferObject*> UsedVBOs;
177  std::map<std::string, std::vector<vtkDataArray*>> UsedDataArrays;
178  std::map<std::string, std::map<vtkDataArray*, vtkIdType>> UsedDataArrayMaps;
179  std::map<std::string, vtkIdType> UsedDataArraySizes;
180 
181 private:
183  void operator=(const vtkOpenGLVertexBufferObjectGroup&) = delete;
184 };
185 
186 #endif
vtkOpenGLVertexBufferObjectGroup::UsedDataArrays
std::map< std::string, std::vector< vtkDataArray * > > UsedDataArrays
Definition: vtkOpenGLVertexBufferObjectGroup.h:177
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkOpenGLVertexBufferObjectGroup
manage vertex buffer objects shared within a mapper
Definition: vtkOpenGLVertexBufferObjectGroup.h:77
vtkX3D::offset
Definition: vtkX3D.h:444
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:44
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkOpenGLVertexBufferObject
Definition: vtkOpenGLVertexBufferObject.h:40
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkOpenGLVertexBufferObjectGroup::UsedVBOs
std::map< std::string, vtkOpenGLVertexBufferObject * > UsedVBOs
Definition: vtkOpenGLVertexBufferObjectGroup.h:176
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkObject.h
vtkOpenGLVertexBufferObjectGroup::UsedDataArrayMaps
std::map< std::string, std::map< vtkDataArray *, vtkIdType > > UsedDataArrayMaps
Definition: vtkOpenGLVertexBufferObjectGroup.h:178
vtkOpenGLVertexBufferObjectGroup::UsedDataArraySizes
std::map< std::string, vtkIdType > UsedDataArraySizes
Definition: vtkOpenGLVertexBufferObjectGroup.h:179
vtkOpenGLVertexBufferObjectCache
manage vertex buffer objects shared within a context
Definition: vtkOpenGLVertexBufferObjectCache.h:38
vtkOpenGLVertexArrayObject
The VertexArrayObject class uses, or emulates, vertex array objects.
Definition: vtkOpenGLVertexArrayObject.h:36
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:285