VTK  9.5.20251215
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
47
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
57VTK_ABI_NAMESPACE_BEGIN
58class vtkDataArray;
63class vtkViewport;
64class vtkWindow;
65
66class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLVertexBufferObjectGroup : public vtkObject
67{
68public:
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
148
155
160
162
167 vtkSetMacro(Instancing, bool);
168 vtkGetMacro(Instancing, bool);
169 vtkBooleanMacro(Instancing, bool);
171
172protected:
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
181private:
183 void operator=(const vtkOpenGLVertexBufferObjectGroup&) = delete;
184
185 bool Instancing = false;
186};
187
188VTK_ABI_NAMESPACE_END
189#endif
a simple class to control print indentation
Definition vtkIndent.h:108
The VertexArrayObject class uses, or emulates, vertex array objects.
manage vertex buffer objects shared within a context
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.
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.
static vtkOpenGLVertexBufferObjectGroup * New()
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:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
#define vtkDataArray
int vtkIdType
Definition vtkType.h:368
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:323