VTK
vtkglVertexArrayObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4 
5  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef vtkglVertexArrayObject_h
15 #define vtkglVertexArrayObject_h
16 
17 #include "vtkRenderingOpenGL2Module.h"
18 #include <string> // For API.
19 
20 class vtkShaderProgram;
21 
22 namespace vtkgl
23 {
24 class BufferObject;
25 
37 class VTKRENDERINGOPENGL2_EXPORT VertexArrayObject
38 {
39 public:
42 
43  void Bind();
44 
45  void Release();
46 
47  void ReleaseGraphicsResources();
48 
49  void ShaderProgramChanged();
50 
52  const std::string &name, int offset, size_t stride,
53  int elementType, int elementTupleSize, bool normalize)
54  {
55  return this->AddAttributeArrayWithDivisor(program, buffer, name,
56  offset,stride,elementType, elementTupleSize, normalize, 0, false);
57  }
58 
59  bool AddAttributeArrayWithDivisor(vtkShaderProgram *program, BufferObject &buffer,
60  const std::string &name, int offset, size_t stride,
61  int elementType, int elementTupleSize, bool normalize,
62  int divisor, bool isMatrix);
63 
64  bool AddAttributeMatrixWithDivisor(vtkShaderProgram *program, BufferObject &buffer,
65  const std::string &name, int offset, size_t stride,
66  int elementType, int elementTupleSize, bool normalize,
67  int divisor);
68 
69  bool RemoveAttributeArray(const std::string &name);
70 
71  // Force this VAO to emulate a vertex aray object even if
72  // the system supports VAOs. This can be useful in cases where
73  // the vertex array object does not handle all extensions.
74  void SetForceEmulation(bool val);
75 
76 private:
77  class Private;
78  Private *d;
79 };
80 
81 } // End of vtkgl namespace
82 
83 #endif // vtkglVertexArrayObject_h
84 
85 // VTK-HeaderTest-Exclude: vtkglVertexArrayObject.h
OpenGL buffer object.
GLuint buffer
Definition: vtkgl.h:11839
GLintptr offset
Definition: vtkgl.h:11844
GLsizei stride
Definition: vtkgl.h:11728
bool AddAttributeArray(vtkShaderProgram *program, BufferObject &buffer, const std::string &name, int offset, size_t stride, int elementType, int elementTupleSize, bool normalize)
GLuint const GLchar * name
Definition: vtkgl.h:11983
Definition: vtkgl.h:11267
The VertexArrayObject class uses, or emulates, vertex array objects.
GLuint program
Definition: vtkgl.h:13011
GLuint divisor
Definition: vtkgl.h:12507
GLsizei const GLchar ** string
Definition: vtkgl.h:12011
GLuint GLfloat * val
Definition: vtkgl.h:13789
The ShaderProgram uses one or more Shader objects.