00001 //============================================================================= 00002 // This file is part of VTKEdge. See vtkedge.org for more information. 00003 // 00004 // Copyright (c) 2010 Kitware, Inc. 00005 // 00006 // VTKEdge may be used under the terms of the BSD License 00007 // Please see the file Copyright.txt in the root directory of 00008 // VTKEdge for further information. 00009 // 00010 // Alternatively, you may see: 00011 // 00012 // http://www.vtkedge.org/vtkedge/project/license.html 00013 // 00014 // 00015 // For custom extensions, consulting services, or training for 00016 // this or any other Kitware supported open source project, please 00017 // contact Kitware at sales@kitware.com. 00018 // 00019 // 00020 //============================================================================= 00025 #ifndef __vtkKWEVertexBufferObject_h 00026 #define __vtkKWEVertexBufferObject_h 00027 00028 #include "vtkObject.h" 00029 #include "VTKEdgeConfigure.h" // include configuration header 00030 #include "vtkWeakPointer.h" // needed for vtkWeakPointer. 00031 00032 class vtkRenderWindow; 00033 class vtkOpenGLExtensionManager; 00034 class vtkDataArray; 00035 class vtkCellArray; 00036 class vtkPainterDeviceAdapter; 00037 00038 class VTKEdge_RENDERING_EXPORT vtkKWEVertexBufferObject : public vtkObject 00039 { 00040 public: 00041 static vtkKWEVertexBufferObject* New(); 00042 vtkTypeRevisionMacro(vtkKWEVertexBufferObject, vtkObject); 00043 void PrintSelf(ostream& os, vtkIndent indent); 00044 00046 00050 void SetContext(vtkRenderWindow* context); 00051 vtkRenderWindow* GetContext(); 00053 00054 //BTX 00055 enum BufferType{ 00056 ARRAY_BUFFER, 00057 ELEMENT_ARRAY_BUFFER 00058 }; 00059 00061 00062 void Bind(BufferType buffer); 00063 //ETX 00065 00066 void UnBind(); 00067 00069 00070 bool Upload(vtkDataArray* array, BufferType type=ARRAY_BUFFER); 00071 bool UploadIndices(vtkCellArray* ca, bool build_draw_multielements_arrays=false); 00072 bool RenderIndices(int vtkprimtype); 00074 00075 vtkGetMacro(Initialized, bool); 00076 //BTX 00077 protected: 00078 vtkKWEVertexBufferObject(); 00079 ~vtkKWEVertexBufferObject(); 00080 00083 bool LoadRequiredExtensions(vtkOpenGLExtensionManager* mgr); 00084 00086 void CreateBuffer(); 00087 00089 void DestroyBuffer(); 00090 00091 vtkWeakPointer<vtkRenderWindow> Context; 00092 unsigned int BufferTarget; // actually GLenum 00093 unsigned int Handle; 00094 bool Initialized; 00095 00096 private: 00097 vtkKWEVertexBufferObject(const vtkKWEVertexBufferObject&); // Not implemented. 00098 void operator=(const vtkKWEVertexBufferObject&); // Not implemented. 00099 00100 class vtkInternals; 00101 vtkInternals* Internals; 00102 //ETX 00103 }; 00104 00105 #endif 00106 00107
1.7.1