VTK  9.3.0
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 
91 
96  vtkOpenGLVertexBufferObject* GetVBO(const char* attribute);
97 
102 
108  void RemoveAttribute(const char* attribute);
109 
116  const char* attribute, vtkDataArray* da, vtkOpenGLVertexBufferObjectCache* cache, int destType);
117  void CacheDataArray(const char* attribute, vtkDataArray* da, vtkViewport* vp, int destType);
118 
126  const char* attribute, vtkDataArray* da, vtkIdType& offset, vtkIdType& totalOffset);
127 
132  void AppendDataArray(const char* attribute, vtkDataArray* da, int destType);
133 
141 
147  void ClearAllVBOs();
148 
155 
159  vtkMTimeType GetMTime() override;
160 
161 protected:
164 
165  std::map<std::string, vtkOpenGLVertexBufferObject*> UsedVBOs;
166  std::map<std::string, std::vector<vtkDataArray*>> UsedDataArrays;
167  std::map<std::string, std::map<vtkDataArray*, vtkIdType>> UsedDataArrayMaps;
168  std::map<std::string, vtkIdType> UsedDataArraySizes;
169 
170 private:
172  void operator=(const vtkOpenGLVertexBufferObjectGroup&) = delete;
173 };
174 
175 VTK_ABI_NAMESPACE_END
176 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
The VertexArrayObject class uses, or emulates, vertex array objects.
manage vertex buffer objects shared within a context
manage vertex buffer objects shared within a mapper
std::map< std::string, std::vector< vtkDataArray * > > UsedDataArrays
void AddAllAttributesToVAO(vtkShaderProgram *program, vtkOpenGLVertexArrayObject *vao)
Attach all VBOs to their attributes.
void ClearAllDataArrays()
Clear all the data arrays.
int GetNumberOfComponents(const char *attribute)
Returns the number of components for this attribute zero if the attribute does not exist.
void CacheDataArray(const char *attribute, vtkDataArray *da, vtkOpenGLVertexBufferObjectCache *cache, int destType)
Set the data array for an attribute in the VBO Group registers the data array until build is called o...
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
static vtkOpenGLVertexBufferObjectGroup * New()
void CacheDataArray(const char *attribute, vtkDataArray *da, vtkViewport *vp, int destType)
std::map< std::string, vtkOpenGLVertexBufferObject * > UsedVBOs
void BuildAllVBOs(vtkViewport *)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::map< std::string, std::map< vtkDataArray *, vtkIdType > > UsedDataArrayMaps
std::map< std::string, vtkIdType > UsedDataArraySizes
int GetNumberOfTuples(const char *attribute)
Returns the number of tuples for this attribute zero if the attribute does not exist.
vtkOpenGLVertexBufferObject * GetVBO(const char *attribute)
Returns the VBO for an attribute, NULL if it is not present.
void AppendDataArray(const char *attribute, vtkDataArray *da, int destType)
Append a data array for an attribute in the VBO Group registers the data array until build is called.
void ClearAllVBOs()
Force all the VBOs to be freed from this group.
vtkMTimeType GetMTime() override
Get the mtime of this groups VBOs.
void BuildAllVBOs(vtkOpenGLVertexBufferObjectCache *)
using the data arrays in this group build all the VBOs, once this has been called the reference to th...
bool ArrayExists(const char *attribute, vtkDataArray *da, vtkIdType &offset, vtkIdType &totalOffset)
Check if the array already exists.
void RemoveAttribute(const char *attribute)
used to remove a no longer needed attribute Calling CacheDataArray with a nullptr attribute will also...
The ShaderProgram uses one or more Shader objects.
abstract specification for Viewports
Definition: vtkViewport.h:54
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ offset
Definition: vtkX3D.h:438
int vtkIdType
Definition: vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270