VTK  9.7.1
vtkOpenGLVertexBufferObjectGroup.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
48 #ifndef vtkOpenGLVertexBufferObjectGroup_h
49 #define vtkOpenGLVertexBufferObjectGroup_h
50 
51 #include "vtkObject.h"
52 #include "vtkRenderingOpenGL2Module.h" // For export macro
53 #include <map> // for methods
54 #include <string> // for ivars
55 #include <vector> // for ivars
56 
57 VTK_ABI_NAMESPACE_BEGIN
58 class vtkDataArray;
62 class vtkShaderProgram;
63 class vtkViewport;
64 class vtkWindow;
65 
66 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexBufferObjectGroup : public vtkObject
67 {
68 public:
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
77  int GetNumberOfComponents(const char* attribute);
78 
83  int GetNumberOfTuples(const char* attribute);
84 
90  void ReleaseGraphicsResources(vtkWindow*);
91 
96  vtkOpenGLVertexBufferObject* GetVBO(const char* attribute);
97 
101  void AddAllAttributesToVAO(vtkShaderProgram* program, vtkOpenGLVertexArrayObject* vao);
102 
108  void RemoveAttribute(const char* attribute);
109 
115  void CacheDataArray(
116  const char* attribute, vtkDataArray* da, vtkOpenGLVertexBufferObjectCache* cache, int destType);
117  void CacheDataArray(const char* attribute, vtkDataArray* da, vtkViewport* vp, int destType);
118 
125  bool ArrayExists(
126  const char* attribute, vtkDataArray* da, vtkIdType& offset, vtkIdType& totalOffset);
127 
132  void AppendDataArray(const char* attribute, vtkDataArray* da, int destType);
133 
139  void BuildAllVBOs(vtkOpenGLVertexBufferObjectCache*);
140  void BuildAllVBOs(vtkViewport*);
141 
147  void ClearAllVBOs();
148 
154  void ClearAllDataArrays();
155 
159  vtkMTimeType GetMTime() override;
160 
162 
167  vtkSetMacro(Instancing, bool);
168  vtkGetMacro(Instancing, bool);
169  vtkBooleanMacro(Instancing, bool);
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  bool Instancing = false;
186 };
187 
188 VTK_ABI_NAMESPACE_END
189 #endif
std::map< std::string, vtkIdType > UsedDataArraySizes
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
std::map< std::string, vtkOpenGLVertexBufferObject * > UsedVBOs
abstract specification for Viewports
Definition: vtkViewport.h:46
manage vertex buffer objects shared within a context
int vtkIdType
Definition: vtkType.h:363
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
a simple class to control print indentation
Definition: vtkIndent.h:28
The VertexArrayObject class uses, or emulates, vertex array objects.
std::map< std::string, std::map< vtkDataArray *, vtkIdType > > UsedDataArrayMaps
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual vtkMTimeType GetMTime()
Return this object's modified time.
std::map< std::string, std::vector< vtkDataArray * > > UsedDataArrays
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
manage vertex buffer objects shared within a mapper
The ShaderProgram uses one or more Shader objects.