/usr/include/vtk-7.1/vtkOpenGLBufferObject.h is in libvtk7-dev 7.1.1+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /*=========================================================================
Program: Visualization Toolkit
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef vtkOpenGLBufferObject_h
#define vtkOpenGLBufferObject_h
#include "vtkRenderingOpenGL2Module.h" // for export macro
#include "vtkObject.h"
#include <vector> // used for method args
class vtkCellArray;
class vtkDataArray;
class vtkPoints;
/**
* @brief OpenGL buffer object
*
* OpenGL buffer object to store index, geometry and/or attribute data on the
* GPU.
*/
class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLBufferObject : public vtkObject
{
public:
static vtkOpenGLBufferObject *New();
vtkTypeMacro(vtkOpenGLBufferObject, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
enum ObjectType
{
ArrayBuffer,
ElementArrayBuffer,
TextureBuffer
};
/** Get the type of the buffer object. */
ObjectType GetType() const;
/** Set the type of the buffer object. */
void SetType(ObjectType value);
/** Get the handle of the buffer object. */
int GetHandle() const;
/** Determine if the buffer object is ready to be used. */
bool IsReady() const { return this->Dirty == false; }
/** Generate the the opengl buffer for this Handle */
bool GenerateBuffer(ObjectType type);
/**
* Upload data to the buffer object. The BufferObject::type() must match
* @a type or be uninitialized.
*
* The T type must have tightly packed values of T::value_type accessible by
* reference via T::operator[]. Additionally, the standard size() and empty()
* methods must be implemented. The std::vector class is an example of such a
* supported containers.
*/
template <class T>
bool Upload(const T &array, ObjectType type);
// non vector version
template <class T>
bool Upload(const T *array, size_t numElements, ObjectType type);
/**
* Bind the buffer object ready for rendering.
* @note Only one ARRAY_BUFFER and one ELEMENT_ARRAY_BUFFER may be bound at
* any time.
*/
bool Bind();
/**
* Release the buffer. This should be done after rendering is complete.
*/
bool Release();
// Description:
// Release any graphics resources that are being consumed by this class.
void ReleaseGraphicsResources();
/**
* Return a string describing errors.
*/
std::string GetError() const { return Error; }
protected:
vtkOpenGLBufferObject();
~vtkOpenGLBufferObject();
bool Dirty;
std::string Error;
bool UploadInternal(const void *buffer, size_t size, ObjectType objectType);
private:
vtkOpenGLBufferObject(const vtkOpenGLBufferObject&) VTK_DELETE_FUNCTION;
void operator=(const vtkOpenGLBufferObject&) VTK_DELETE_FUNCTION;
struct Private;
Private *Internal;
};
template <class T>
inline bool vtkOpenGLBufferObject::Upload(
const T &array,
vtkOpenGLBufferObject::ObjectType objectType)
{
if (array.empty())
{
this->Error = "Refusing to upload empty array.";
return false;
}
return this->UploadInternal(&array[0],
array.size() * sizeof(typename T::value_type),
objectType);
}
template <class T>
inline bool vtkOpenGLBufferObject::Upload(
const T *array, size_t numElements,
vtkOpenGLBufferObject::ObjectType objectType)
{
if (!array)
{
this->Error = "Refusing to upload empty array.";
return false;
}
return this->UploadInternal(array,
numElements * sizeof(T),
objectType);
}
#endif
|