Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __vtkVertexBufferObject_h
00028 #define __vtkVertexBufferObject_h
00029
00030 #include <vector>
00031
00032 #include "vtkObject.h"
00033 #include "vtkWeakPointer.h"
00034
00035 #include "vtkgl.h"
00036 #include <pcl/pcl_macros.h>
00037
00038 class vtkCellArray;
00039 class vtkDataArray;
00040 class vtkObject;
00041 class vtkPoints;
00042 class vtkUnsignedCharArray;
00043 class vtkOpenGLExtensionManager;
00044 class vtkRenderWindow;
00045
00046 class PCL_EXPORTS vtkVertexBufferObject : public vtkObject
00047 {
00048 public:
00049
00050 static vtkVertexBufferObject* New();
00051 vtkTypeMacro(vtkVertexBufferObject, vtkObject);
00052 void PrintSelf(ostream& os, vtkIndent indent);
00053
00054
00055
00056
00057
00058
00059
00060 void SetContext(vtkRenderWindow* context);
00061 vtkRenderWindow* GetContext();
00062
00063
00064
00065 enum
00066 {
00067 StreamDraw=0,
00068 StreamRead,
00069 StreamCopy,
00070 StaticDraw,
00071 StaticRead,
00072 StaticCopy,
00073 DynamicDraw,
00074 DynamicRead,
00075 DynamicCopy,
00076 NumberOfUsages
00077 };
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 vtkGetMacro(Usage, int);
00097 vtkSetMacro(Usage, int);
00098
00099 int GetAttributeIndex();
00100 void SetUserDefinedAttribute(int index, bool normalized=false, int stride=0);
00101 void ResetUserDefinedAttribute();
00102
00103 void SetAttributeNormalized(bool normalized);
00104
00105
00106
00107 bool Upload(vtkPoints *points);
00108
00109
00110
00111 bool Upload(vtkCellArray *verts);
00112
00113
00114
00115 bool Upload(unsigned int *indices, unsigned int count);
00116
00117
00118
00119 bool Upload(vtkUnsignedCharArray *colors);
00120
00121
00122
00123 bool Upload(vtkDataArray *array);
00124 bool Upload(vtkDataArray *array, int attributeType, int arrayType);
00125 bool UploadNormals(vtkDataArray *normals);
00126 bool UploadColors(vtkDataArray *colors);
00127
00128
00129
00130
00131
00132 vtkGetMacro(Size, unsigned int);
00133
00134
00135
00136
00137 vtkGetMacro(Count, unsigned int);
00138
00139
00140
00141 vtkGetMacro(Handle, unsigned int);
00142
00143
00144
00145 void UnBind();
00146
00147
00148
00149 void Bind();
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159 void ReleaseMemory();
00160
00161
00162
00163 static bool IsSupported(vtkRenderWindow* renWin);
00164
00165
00166
00167 protected:
00168 vtkVertexBufferObject();
00169 ~vtkVertexBufferObject();
00170
00171
00172
00173
00174 bool LoadRequiredExtensions(vtkOpenGLExtensionManager* mgr);
00175
00176
00177
00178 void CreateBuffer();
00179
00180
00181
00182 void DestroyBuffer();
00183
00184
00185
00186 bool Upload(GLvoid* data);
00187
00188
00189
00190 vtkGetMacro(ArrayType, unsigned int);
00191
00192 int Usage;
00193 unsigned int Size;
00194 unsigned int Count;
00195 unsigned int Handle;
00196 unsigned int ArrayType;
00197 unsigned int BufferTarget;
00198
00199 int AttributeIndex;
00200 int AttributeSize;
00201 int AttributeType;
00202 int AttributeNormalized;
00203 int AttributeStride;
00204
00205 vtkWeakPointer<vtkRenderWindow> Context;
00206
00207
00208 private:
00209 vtkVertexBufferObject(const vtkVertexBufferObject&);
00210 void operator=(const vtkVertexBufferObject&);
00211
00212
00213 int GetDataTypeSize(int type);
00214
00215 };
00216
00217 #endif
00218
00219