Index: /OpenSceneGraph/trunk/include/osg/BufferObject
===================================================================
--- /OpenSceneGraph/trunk/include/osg/BufferObject (revision 9302)
+++ /OpenSceneGraph/trunk/include/osg/BufferObject (revision 10600)
@@ -100,70 +100,73 @@
 
 class State;
-
-class OSG_EXPORT BufferObject : public Object
-{
-    public:
-
-        BufferObject();
-
-        /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
-        BufferObject(const BufferObject& bo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
-
-        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferObject*>(obj)!=NULL; }
-        virtual const char* libraryName() const { return "osg"; }
-        virtual const char* className() const { return "BufferObject"; }
-
-        /** Set what type of usage the buffer object will have. Options are: 
-          *          GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, 
-          *          GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, 
-          *          GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
-          */
-        void setUsage(GLenum usage) { _usage = usage; }
-        
-        /** Get the type of usage the buffer object has been set up for.*/
-        GLenum getUsage() const { return _usage; }
+class BufferData;
+class BufferObject;
+
+class OSG_EXPORT GLBufferObject : public Referenced
+{
+    public:
+
+        GLBufferObject(unsigned int contextID, BufferObject* bufferObject=0);
+
+        void setBufferObject(BufferObject* bufferObject);
+        BufferObject* getBufferObject() { return _bufferObject; }
 
         struct BufferEntry
         {
-            BufferEntry(): dataSize(0),offset(0) {}
-            BufferEntry(const BufferEntry& be): modifiedCount(be.modifiedCount),dataSize(be.dataSize),offset(be.offset) {}
-        
-            BufferEntry& operator = (const BufferEntry& be) { modifiedCount=be.modifiedCount; dataSize=be.dataSize; offset=be.offset; return *this; }
-
-            mutable buffered_value<unsigned int>    modifiedCount;
-            mutable unsigned int                    dataSize;
-            mutable unsigned int                    offset;
+            BufferEntry(): modifiedCount(0),dataSize(0),offset(0),dataSource(0) {}
+
+            BufferEntry(const BufferEntry& rhs):
+                modifiedCount(rhs.modifiedCount),
+                dataSize(rhs.dataSize),
+                offset(rhs.offset),
+                dataSource(rhs.dataSource) {}
+
+            BufferEntry& operator = (const BufferEntry& rhs)
+            {
+                if (&rhs==this) return *this;
+                modifiedCount = rhs.modifiedCount;
+                dataSize = rhs.dataSize;
+                offset = rhs.offset;
+                dataSource = rhs.dataSource;
+                return *this;
+            }
+
+            unsigned int        modifiedCount;
+            GLsizeiptrARB       dataSize;
+            GLsizeiptrARB       offset;
+            BufferData*         dataSource;
         };
 
-        inline bool isBufferObjectSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isBufferObjectSupported(); }
-        inline bool isPBOSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isPBOSupported(); }
-
-        inline GLuint& buffer(unsigned int contextID) const { return _bufferObjectList[contextID]; }
-        
-        inline void bindBuffer(unsigned int contextID) const
+        inline unsigned int getContextID() const { return _contextID; }
+
+        inline GLuint& getGLObjectID() { return _glObjectID; }
+        inline GLuint getGLObjectID() const { return _glObjectID; }
+        inline GLsizeiptrARB getOffset(unsigned int i) const { return _bufferEntries[i].offset; }
+
+        inline void bindBuffer() const
         { 
-            Extensions* extensions = getExtensions(contextID,true);
-            extensions->glBindBuffer(_target,_bufferObjectList[contextID]);
+            _extensions->glBindBuffer(_target,_glObjectID);
         }
 
-        virtual void unbindBuffer(unsigned int contextID) const
+        inline void unbindBuffer() const
         { 
-            Extensions* extensions = getExtensions(contextID,true);
-            extensions->glBindBuffer(_target,0);
+            _extensions->glBindBuffer(_target,0);
         }
 
-        inline void dirty() { _compiledList.setAllElementsTo(0); }
-
-        bool isDirty(unsigned int contextID) const { return _compiledList[contextID]==0; }
-
-        virtual void compileBuffer(State& state) const = 0;
-        
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int maxSize);
-
-        /** If State is non-zero, this function releases OpenGL objects for
-          * the specified graphics context. Otherwise, releases OpenGL objects
-          * for all graphics contexts. */
-        void releaseGLObjects(State* state=0) const;
+        inline bool isDirty() const { return _dirty; }
+
+        void dirty() { _dirty = true; }
+
+        void clear();
+
+        void compileBuffer();
+
+        void deleteGLObject();
+
+        void assign(BufferObject* bufferObject);
+
+        bool isPBOSupported() const { return _extensions->isPBOSupported(); }
+
+        static GLBufferObject* createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject);
 
 
@@ -257,16 +260,145 @@
     protected:
     
-        virtual ~BufferObject();
-        
-        typedef osg::buffered_value<GLuint> GLObjectList;
-        typedef osg::buffered_value<unsigned int> CompiledList;
-
-        mutable GLObjectList    _bufferObjectList;
-        mutable CompiledList    _compiledList;
+        virtual ~GLBufferObject();
+
+        unsigned int            _contextID;
+        GLuint                  _glObjectID;
 
         GLenum                  _target;
         GLenum                  _usage;
+
+        bool                    _dirty;
+
         mutable unsigned int    _totalSize;
-};
+
+        typedef std::vector<BufferEntry> BufferEntries;
+        BufferEntries           _bufferEntries;
+
+        BufferObject*           _bufferObject;
+
+    public:
+        Extensions*             _extensions;
+
+};
+
+class OSG_EXPORT BufferObject : public Object
+{
+    public:
+
+        BufferObject();
+
+        /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
+        BufferObject(const BufferObject& bo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
+
+        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferObject*>(obj)!=NULL; }
+        virtual const char* libraryName() const { return "osg"; }
+        virtual const char* className() const { return "BufferObject"; }
+
+        void setTarget(GLenum target) { _target = target; }
+        GLenum getTarget() const { return _target; }
+
+        /** Set what type of usage the buffer object will have. Options are:
+          *          GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY,
+          *          GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY,
+          *          GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
+          */
+        void setUsage(GLenum usage) { _usage = usage; }
+
+        /** Get the type of usage the buffer object has been set up for.*/
+        GLenum getUsage() const { return _usage; }
+
+        void dirty();
+
+        /** Resize any per context GLObject buffers to specified size. */
+        virtual void resizeGLObjectBuffers(unsigned int maxSize);
+
+        /** If State is non-zero, this function releases OpenGL objects for
+          * the specified graphics context. Otherwise, releases OpenGL objects
+          * for all graphics contexts. */
+        void releaseGLObjects(State* state=0) const;
+
+        unsigned int addBufferData(BufferData* bd);
+        void removeBufferData(unsigned int index);
+        void removeBufferData(BufferData* bd);
+
+        void setBufferData(unsigned int index, BufferData* bd);
+        BufferData* getBufferData(unsigned int index) { return _bufferDataList[index]; }
+        const BufferData* getBufferData(unsigned int index) const { return _bufferDataList[index]; }
+
+        unsigned int getNumBufferData() const { return _bufferDataList.size(); }
+
+        GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _glBufferObjects[contextID].get(); }
+
+        GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const
+        {
+            if (!_glBufferObjects[contextID]) _glBufferObjects[contextID] = GLBufferObject::createGLBufferObject(contextID, this);
+            return _glBufferObjects[contextID].get();
+        }
+
+    protected:
+
+        ~BufferObject();
+
+        typedef std::vector< BufferData* > BufferDataList;
+        typedef osg::buffered_object< osg::ref_ptr<GLBufferObject> > GLBufferObjects;
+
+        GLenum                  _target;
+        GLenum                  _usage;
+        BufferDataList          _bufferDataList;
+
+        mutable GLBufferObjects _glBufferObjects;
+};
+
+class BufferData : public Object
+{
+    public:
+
+        BufferData():
+            Object(true),
+            _modifiedCount(0),
+            _bufferIndex(0) {}
+
+        /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
+        BufferData(const BufferData& bd,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
+            osg::Object(bd,copyop),
+            _modifiedCount(0),
+            _bufferIndex(0) {}
+
+        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferData*>(obj)!=NULL; }
+        virtual const char* libraryName() const { return "osg"; }
+        virtual const char* className() const { return "BufferData"; }
+
+        virtual const GLvoid*   getDataPointer() const = 0;
+        virtual unsigned int    getTotalDataSize() const = 0;
+
+        void setBufferObject(BufferObject* bufferObject);
+        BufferObject* getBufferObject() { return _bufferObject.get(); }
+        const BufferObject* getBufferObject() const { return _bufferObject.get(); }
+
+        void setBufferIndex(unsigned int index) { _bufferIndex = index; }
+        unsigned int getBufferIndex() const { return _bufferIndex; }
+
+        GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getGLBufferObject(contextID) : 0; }
+        GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getOrCreateGLBufferObject(contextID) : 0; }
+
+        /** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
+        inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }
+
+        /** Set the modified count value.*/
+        inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
+
+        /** Get modified count value.*/
+        inline unsigned int getModifiedCount() const { return _modifiedCount; }
+
+    protected:
+
+        virtual ~BufferData();
+
+        unsigned int                    _modifiedCount;
+
+        unsigned int                    _bufferIndex;
+        osg::ref_ptr<BufferObject>      _bufferObject;
+};
+
 
 class Array;
@@ -281,7 +413,4 @@
 
         META_Object(osg,VertexBufferObject);
-        
-        typedef std::pair< BufferEntry, Array* > BufferEntryArrayPair;
-        typedef std::vector< BufferEntryArrayPair > BufferEntryArrayPairs;
 
         unsigned int addArray(osg::Array* array);
@@ -289,19 +418,9 @@
 
         void setArray(unsigned int i, Array* array);
-        Array* getArray(unsigned int i) { return _bufferEntryArrayPairs[i].second; }
-        const Array* getArray(unsigned int i) const { return _bufferEntryArrayPairs[i].second; }
-        
-        const GLvoid* getOffset(unsigned int i) const { return (const GLvoid*)(((char *)0)+(_bufferEntryArrayPairs[i].first.offset)); }
-
-        virtual void compileBuffer(State& state) const;
-
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int maxSize);
-
-    protected:
-    
+        Array* getArray(unsigned int i);
+        const Array* getArray(unsigned int i) const;
+
+    protected:
         virtual ~VertexBufferObject();
-        
-        BufferEntryArrayPairs _bufferEntryArrayPairs;
 };
 
@@ -318,26 +437,14 @@
         META_Object(osg,ElementBufferObject);
         
-        typedef std::pair< BufferEntry, DrawElements* > BufferEntryDrawElementsPair;
-        typedef std::vector< BufferEntryDrawElementsPair > BufferEntryDrawElementsPairs;
-
         unsigned int addDrawElements(osg::DrawElements* PrimitiveSet);
         void removeDrawElements(osg::DrawElements* PrimitiveSet);
 
         void setDrawElements(unsigned int i, DrawElements* PrimitiveSet);
-        DrawElements* getDrawElements(unsigned int i) { return _bufferEntryDrawElementsPairs[i].second; }
-        const DrawElements* getDrawElements(unsigned int i) const { return _bufferEntryDrawElementsPairs[i].second; }
-        
-        const GLvoid* getOffset(unsigned int i) const { return (const GLvoid*)(((char *)0)+(_bufferEntryDrawElementsPairs[i].first.offset)); }
-
-        virtual void compileBuffer(State& state) const;
-
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int maxSize);
+        DrawElements* getDrawElements(unsigned int i);
+        const DrawElements* getDrawElements(unsigned int i) const;
 
     protected:
     
         virtual ~ElementBufferObject();
-        
-        BufferEntryDrawElementsPairs _bufferEntryDrawElementsPairs;
 };
 
@@ -353,24 +460,15 @@
 
         META_Object(osg,PixelBufferObject);
-        
-        typedef std::pair< BufferEntry, Image* > BufferEntryImagePair;
 
         void setImage(osg::Image* image);
 
-        Image* getImage() { return _bufferEntryImagePair.second; }
-        const Image* getImage() const { return _bufferEntryImagePair.second; }
-        
-        unsigned int offset() const { return _bufferEntryImagePair.first.offset; }
-        
-        virtual void compileBuffer(State& state) const;
-
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int maxSize);
+        Image* getImage();
+        const Image* getImage() const;
+
+        bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); }
 
     protected:
     
         virtual ~PixelBufferObject();
-        
-        BufferEntryImagePair _bufferEntryImagePair;
 };
 
@@ -390,8 +488,8 @@
 
         //! Set new size of the buffer object. This will reallocate the memory on the next compile
-        inline void setDataSize(unsigned int size) { _bufferData.dataSize = size; dirty(); }
+        inline void setDataSize(unsigned int size) { _dataSize = size; dirty(); }
 
         //! Get data size of the used buffer 
-        inline unsigned int getDataSize() { return _bufferData.dataSize; }
+        inline unsigned int getDataSize() const { return _dataSize; }
 
         //! Compile the buffer (reallocate the memory if buffer is dirty)
@@ -428,5 +526,5 @@
         virtual ~PixelDataBufferObject();
 
-        BufferEntry _bufferData;
+        unsigned int _dataSize;
 
         typedef osg::buffered_value<unsigned int> ModeList;
Index: /OpenSceneGraph/trunk/include/osg/PrimitiveSet
===================================================================
--- /OpenSceneGraph/trunk/include/osg/PrimitiveSet (revision 9969)
+++ /OpenSceneGraph/trunk/include/osg/PrimitiveSet (revision 10600)
@@ -148,5 +148,5 @@
 class DrawElements;
 
-class OSG_EXPORT PrimitiveSet : public Object
+class OSG_EXPORT PrimitiveSet : public BufferData
 {
     public:
@@ -180,13 +180,11 @@
             _numInstances(numInstances),
             _mode(mode),
-            _modifiedCount(0),
             _rangeModifiedCount(0) {}
     
         PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
-            Object(prim,copyop),
+            BufferData(prim,copyop),
             _primitiveType(prim._primitiveType),
             _numInstances(prim._numInstances),
             _mode(prim._mode),
-            _modifiedCount(0),
             _rangeModifiedCount(0) {}
 
@@ -220,21 +218,4 @@
         virtual unsigned int getNumPrimitives() const; 
 
-        /** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
-        virtual void dirty() { ++_modifiedCount; }      
-      
-        /** Set the modified count value.*/
-        inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
-
-        /** Get modified count value.*/
-        inline unsigned int getModifiedCount() const { return _modifiedCount; }
-
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
-
-        /** If State is non-zero, this function releases OpenGL objects for
-          * the specified graphics context. Otherwise, releases OpenGL objects
-          * for all graphics contexts. */
-        virtual void releaseGLObjects(State* /*state*/=0) const {}
-
         virtual void computeRange() const {}
 
@@ -246,29 +227,5 @@
         int             _numInstances;
         GLenum          _mode;
-        unsigned int    _modifiedCount;
         mutable unsigned int    _rangeModifiedCount;
-
-        struct ObjectIDModifiedCountPair
-        {
-            ObjectIDModifiedCountPair():
-                _objectID(0),
-                _modifiedCount(0) {}
-                
-            ObjectIDModifiedCountPair(const ObjectIDModifiedCountPair& obj):
-                _objectID(obj._objectID),
-                _modifiedCount(obj._modifiedCount) {}
-                
-            ObjectIDModifiedCountPair& operator = (const ObjectIDModifiedCountPair& obj)
-            {
-                _objectID = obj._objectID;
-                _modifiedCount = obj._modifiedCount;
-                return *this;
-            }
-
-            GLuint _objectID;
-            unsigned int _modifiedCount;
-        };
-        
-        typedef osg::buffered_object<ObjectIDModifiedCountPair> GLObjectList;
 };
 
@@ -393,10 +350,8 @@
         
         DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
-            PrimitiveSet(primType,mode, numInstances),
-            _eboOffset(0) {}
+            PrimitiveSet(primType,mode, numInstances) {}
     
         DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
-            PrimitiveSet(copy,copyop),
-            _eboOffset(0) {}
+            PrimitiveSet(copy,copyop) {}
 
 
@@ -404,52 +359,13 @@
         virtual const DrawElements* getDrawElements() const { return this; }
 
-        virtual void dirty() { ++_modifiedCount; if (_ebo.valid()) _ebo->dirty(); } 
-
         /** Set the ElementBufferObject.*/
-        inline void setElementBufferObject(osg::ElementBufferObject* ebo)
-        {
-            if (_ebo == ebo) return;
-            
-            if (_ebo.valid())
-            {
-                _ebo->removeDrawElements(this);
-            }
-            
-            _ebo = ebo;
-
-            if (_ebo.valid())
-            {
-                _ebo->addDrawElements(this);
-            }
-        }
-        
+        inline void setElementBufferObject(osg::ElementBufferObject* ebo) { setBufferObject(ebo); }
+
         /** Get the ElementBufferObject. If no EBO is assigned returns NULL*/
-        inline osg::ElementBufferObject* getElementBufferObject() { return _ebo.get(); }
+        inline osg::ElementBufferObject* getElementBufferObject() { return dynamic_cast<osg::ElementBufferObject*>(_bufferObject.get()); }
 
         /** Get the const ElementBufferObject. If no EBO is assigned returns NULL*/
-        inline const osg::ElementBufferObject* getElementBufferObject() const { return _ebo.get(); }
-
-        /** Set the offset into the ElementBufferObject, if used.*/
-        inline void setElementBufferObjectOffset(const GLvoid* offset) const { _eboOffset = offset; }
-
-        /** Get the offset into the ElementBufferOffset, if used.*/
-        inline const GLvoid* getElementBufferObjectOffset() const { return _eboOffset; }
-
-
-        /** Resize any per context GLObject buffers to specified size. */
-        virtual void resizeGLObjectBuffers(unsigned int maxSize)
-        {
-            if (_ebo.valid()) _ebo->resizeGLObjectBuffers(maxSize);
-        }
-
-        /** If State is non-zero, this function releases OpenGL objects for
-          * the specified graphics context. Otherwise, releases OpenGL objects
-          * for all graphics contexts. */
-        virtual void releaseGLObjects(State* state=0) const
-        {
-            if (_ebo.valid()) _ebo->releaseGLObjects(state);
-        }
-        
-        
+        inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }
+
         virtual void reserveElements(unsigned int numIndices) = 0;
         virtual void setElement(unsigned int, unsigned int) = 0;
@@ -458,16 +374,6 @@
 
     protected:
-    
-        virtual ~DrawElements()
-        {
-            if (_ebo.valid())
-            {
-                _ebo->removeDrawElements(this);
-            }
-        }
-
-        osg::ref_ptr<ElementBufferObject>   _ebo;
-        mutable const GLvoid*               _eboOffset;
-
+
+        virtual ~DrawElements() {}
 };
 
Index: /OpenSceneGraph/trunk/include/osg/Image
===================================================================
--- /OpenSceneGraph/trunk/include/osg/Image (revision 9913)
+++ /OpenSceneGraph/trunk/include/osg/Image (revision 10600)
@@ -62,5 +62,5 @@
 
 /** Image class for encapsulating the storage texture image data. */
-class OSG_EXPORT Image : public Object
+class OSG_EXPORT Image : public BufferData
 {
 
@@ -77,4 +77,7 @@
         virtual const char* libraryName() const { return "osg"; }
         virtual const char* className() const { return "Image"; }
+
+        virtual const GLvoid*   getDataPointer() const { return data(); }
+        virtual unsigned int    getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); }
 
         /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
@@ -253,14 +256,4 @@
         */
         void ensureValidSizeForTexturing(GLint maxTextureSize);
-      
-        /** Dirty the image, which increments the modified count, to force osg::Texture to reload the image. */
-        inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }      
-      
-        /** Set the modified count value. Used by osg::Texture when using texture subloading. */
-        inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
-
-        /** Get modified count value. Used by osg::Texture when using texture subloading. */
-        inline unsigned int getModifiedCount() const { return _modifiedCount; }
-
 
         static bool isPackedType(GLenum type);
@@ -317,13 +310,13 @@
 
         /** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */ 
-        void setPixelBufferObject(PixelBufferObject* buffer) { _bufferObject = buffer; if (_bufferObject.valid()) _bufferObject->setImage(this); }
-
-        /** Get the PixelBufferObject.*/ 
-        PixelBufferObject* getPixelBufferObject() { return _bufferObject.get(); }
-
-        /** Get the const PixelBufferObject.*/ 
-        const PixelBufferObject* getPixelBufferObject() const { return _bufferObject.get(); }
+        void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); }
+
+        /** Get the PixelBufferObject.*/
+        PixelBufferObject* getPixelBufferObject() { return dynamic_cast<PixelBufferObject*>(_bufferObject.get()); }
+
+        /** Get the const PixelBufferObject.*/
+        const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(_bufferObject.get()); }
        
-        virtual void update(NodeVisitor* /*nv*/) {}        
+        virtual void update(NodeVisitor* /*nv*/) {}
 
         /** method for sending pointer events to images that are acting as front ends to interactive surfaces such as a vnc or browser window.  Return true if handled. */
@@ -361,6 +354,4 @@
         
         void setData(unsigned char* data,AllocationMode allocationMode);
-
-        unsigned int _modifiedCount;
 
         MipmapDataType _mipmapData;
Index: /OpenSceneGraph/trunk/include/osg/State
===================================================================
--- /OpenSceneGraph/trunk/include/osg/State (revision 10588)
+++ /OpenSceneGraph/trunk/include/osg/State (revision 10600)
@@ -406,11 +406,11 @@
 
 
-        void setCurrentVertexBufferObject(osg::VertexBufferObject* vbo) { _currentVBO = vbo; }
-        const VertexBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
-        inline void bindVertexBufferObject(const osg::VertexBufferObject* vbo)
+        void setCurrentVertexBufferObject(osg::GLBufferObject* vbo) { _currentVBO = vbo; }
+        const GLBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
+        inline void bindVertexBufferObject(osg::GLBufferObject* vbo)
         {
             if (vbo == _currentVBO) return;
-            if (vbo->isDirty(_contextID)) vbo->compileBuffer(*this);
-            else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo->buffer(_contextID));
+            if (vbo->isDirty()) vbo->compileBuffer();
+            else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo->getGLObjectID());
             _currentVBO = vbo;
         }
@@ -423,12 +423,12 @@
         }
 
-        void setCurrentElementBufferObject(osg::ElementBufferObject* ebo) { _currentEBO = ebo; }
-        const ElementBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
-
-        inline void bindElementBufferObject(const osg::ElementBufferObject* ebo)
+        void setCurrentElementBufferObject(osg::GLBufferObject* ebo) { _currentEBO = ebo; }
+        const GLBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
+
+        inline void bindElementBufferObject(osg::GLBufferObject* ebo)
         {
             if (ebo == _currentEBO) return;
-            if (ebo->isDirty(_contextID)) ebo->compileBuffer(*this);
-            else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo->buffer(_contextID));
+            if (ebo->isDirty()) ebo->compileBuffer();
+            else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo->getGLObjectID());
             _currentEBO = ebo;
         }
@@ -441,13 +441,13 @@
         }
 
-        void setCurrentPixelBufferObject(osg::PixelBufferObject* pbo) { _currentPBO = pbo; }
-        const PixelBufferObject* getCurrentPixelBufferObject() { return _currentPBO; }
-
-        inline void bindPixelBufferObject(const osg::PixelBufferObject* pbo)
+        void setCurrentPixelBufferObject(osg::GLBufferObject* pbo) { _currentPBO = pbo; }
+        const GLBufferObject* getCurrentPixelBufferObject() { return _currentPBO; }
+
+        inline void bindPixelBufferObject(osg::GLBufferObject* pbo)
         {
             if (pbo == _currentPBO) return;
 
-            if (pbo->isDirty(_contextID)) pbo->compileBuffer(*this);
-            else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo->buffer(_contextID));
+            if (pbo->isDirty()) pbo->compileBuffer();
+            else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo->getGLObjectID());
 
             _currentPBO = pbo;
@@ -486,9 +486,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-                    setVertexPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
+                    setVertexPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -543,9 +543,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-                setNormalPointer(array->getDataType(),0,array->getVertexBufferObjectOffset());
+                    setNormalPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -599,9 +599,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-                    setColorPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
+                    setColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -660,13 +660,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-#if 0
-                    setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
-#else
-                    setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
-#endif
+                    setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -746,13 +742,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-#if 0
-                    setFogCoordPointer(array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
-#else
-                    setFogCoordPointer(array->getDataType(),0,array->getVertexBufferObjectOffset());
-#endif
+                    setFogCoordPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -795,13 +787,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-#if 0
-                    setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
-#else
-                    setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
-#endif
+                    setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0, (const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -917,13 +905,9 @@
             if (array)
             {
-                const VertexBufferObject* vbo = array->getVertexBufferObject();
+                GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
                 if (vbo)
                 {
                     bindVertexBufferObject(vbo);
-#if 0
-                    setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,vbo->getOffset(array->getVertexBufferObjectIndex()));
-#else
-                    setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,array->getVertexBufferObjectOffset());
-#endif
+                    setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
                 }
                 else
@@ -1280,7 +1264,7 @@
         unsigned int                    _currentActiveTextureUnit;
         unsigned int                    _currentClientActiveTextureUnit;
-        const VertexBufferObject*       _currentVBO;
-        const ElementBufferObject*      _currentEBO;
-        const PixelBufferObject*        _currentPBO;
+        GLBufferObject*                 _currentVBO;
+        GLBufferObject*                 _currentEBO;
+        GLBufferObject*                 _currentPBO;
 
 
Index: /OpenSceneGraph/trunk/include/osg/Array
===================================================================
--- /OpenSceneGraph/trunk/include/osg/Array (revision 10061)
+++ /OpenSceneGraph/trunk/include/osg/Array (revision 10600)
@@ -44,5 +44,5 @@
 class ConstValueVisitor;
 
-class OSG_EXPORT Array : public Object
+class OSG_EXPORT Array : public BufferData
 {
 
@@ -78,15 +78,11 @@
             _arrayType(arrayType),
             _dataSize(dataSize),
-            _dataType(dataType),
-            _modifiedCount(0),
-            _vboOffset(0) {}
+            _dataType(dataType) {}
     
         Array(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
-            Object(array,copyop),
+            BufferData(array,copyop),
             _arrayType(array._arrayType),
             _dataSize(array._dataSize),
-            _dataType(array._dataType),
-            _modifiedCount(0),
-            _vboOffset(0) {}
+            _dataType(array._dataType) {}
 
         virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Array*>(obj)!=NULL; }
@@ -114,59 +110,20 @@
         virtual void trim() {}
 
-        /** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
-        inline void dirty() { ++_modifiedCount; if (_vbo.valid()) _vbo->dirty(); }
-      
-        /** Set the modified count value.*/
-        inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
-
-        /** Get modified count value.*/
-        inline unsigned int getModifiedCount() const { return _modifiedCount; }
-
         /** Set the VertexBufferObject.*/
-        inline void setVertexBufferObject(osg::VertexBufferObject* vbo)
-        {
-            if (_vbo == vbo) return;
-            
-            if (_vbo.valid())
-            {
-                _vbo->removeArray(this);
-            }
-            
-            _vbo = vbo;
-            
-            if (_vbo.valid())
-            {
-                _vbo->addArray(this);
-            }
-        }
-        
+        inline void setVertexBufferObject(osg::VertexBufferObject* vbo) { setBufferObject(vbo); }
+
         /** Get the VertexBufferObject. If no VBO is assigned returns NULL*/
-        inline osg::VertexBufferObject* getVertexBufferObject() { return _vbo.get(); }
+        inline osg::VertexBufferObject* getVertexBufferObject() { return dynamic_cast<osg::VertexBufferObject*>(_bufferObject.get()); }
 
         /** Get the const VertexBufferObject. If no VBO is assigned returns NULL*/
-        inline const osg::VertexBufferObject* getVertexBufferObject() const { return _vbo.get(); }
-
-        /** Set the offset into the VertexBufferObject, if used.*/
-        void setVertexBufferObjectOffset(const GLvoid* offset ) const { _vboOffset = offset; }
-
-        /** Get the offset into the VertexBufferObject, if used.*/
-        const GLvoid* getVertexBufferObjectOffset() const { return _vboOffset; }
+        inline const osg::VertexBufferObject* getVertexBufferObject() const { return dynamic_cast<const osg::VertexBufferObject*>(_bufferObject.get());  }
 
     protected:
-    
-        virtual ~Array()
-        {
-            if (_vbo.valid())
-            {
-                _vbo->removeArray(this);
-            }
-        }
+
+        virtual ~Array() {}
 
         Type                                    _arrayType;
         GLint                                   _dataSize;
         GLenum                                  _dataType;
-        unsigned int                            _modifiedCount;
-        osg::ref_ptr<osg::VertexBufferObject>   _vbo;
-        mutable const GLvoid*                   _vboOffset;
 };
 
Index: /OpenSceneGraph/trunk/src/osg/Texture.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/Texture.cpp (revision 10598)
+++ /OpenSceneGraph/trunk/src/osg/Texture.cpp (revision 10600)
@@ -47,5 +47,5 @@
 #endif
 
-//#define DO_TIMING
+// #define DO_TIMING
 
 namespace osg {
@@ -1778,13 +1778,10 @@
     bool useGluBuildMipMaps = mipmappingRequired && (!useHardwareMipMapGeneration && !image->isMipmap());
 
-    unsigned char* dataMinusOffset = 0;
-    unsigned char* dataPlusOffset = 0;
-
-    const PixelBufferObject* pbo = image->getPixelBufferObject();
-    if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale && !useGluBuildMipMaps)
+    const unsigned char* dataPtr = image->data();
+    GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
+    if (pbo && !needImageRescale && !useGluBuildMipMaps)
     {
         state.bindPixelBufferObject(pbo);
-        dataMinusOffset = data;
-        dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
+        dataPtr = reinterpret_cast<const unsigned char*>(pbo->getOffset(image->getBufferIndex()));
 #ifdef DO_TIMING
         osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
@@ -1809,5 +1806,5 @@
                 (GLenum)image->getPixelFormat(),
                 (GLenum)image->getDataType(),
-                data -dataMinusOffset+dataPlusOffset);
+                dataPtr);
 
         }
@@ -1822,5 +1819,5 @@
                 inwidth, inheight,0, 
                 size, 
-                data-dataMinusOffset+dataPlusOffset);                
+                dataPtr);
         }
 
@@ -1854,5 +1851,5 @@
                         (GLenum)image->getPixelFormat(),
                         (GLenum)image->getDataType(),
-                        image->getMipmapData(k)-dataMinusOffset+dataPlusOffset);
+                        dataPtr + image->getMipmapOffset(k));
 
                     width >>= 1;
@@ -1875,5 +1872,5 @@
                     extensions->glCompressedTexImage2D(target, k, _internalFormat, 
                                                        width, height, _borderWidth, 
-                                                       size, image->getMipmapData(k)-dataMinusOffset+dataPlusOffset);                
+                                                       size, dataPtr + image->getMipmapOffset(k));
 
                     width >>= 1;
@@ -2028,10 +2025,10 @@
     unsigned char* dataPlusOffset = 0;
     
-    const PixelBufferObject* pbo = image->getPixelBufferObject();
-    if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale && !useGluBuildMipMaps)
+    const unsigned char* dataPtr = image->data();
+    GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
+    if (pbo && !needImageRescale && !useGluBuildMipMaps)
     {
         state.bindPixelBufferObject(pbo);
-        dataMinusOffset = data;
-        dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
+        dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
 #ifdef DO_TIMING
         osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
Index: /OpenSceneGraph/trunk/src/osg/BufferObject.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/BufferObject.cpp (revision 9362)
+++ /OpenSceneGraph/trunk/src/osg/BufferObject.cpp (revision 10600)
@@ -38,5 +38,183 @@
 static DeletedBufferObjectCache s_deletedBufferObjectCache;
 
-void BufferObject::deleteBufferObject(unsigned int contextID,GLuint globj)
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// GLBufferObject
+//
+GLBufferObject::GLBufferObject(unsigned int contextID, BufferObject* bufferObject):
+    _contextID(contextID),
+    _glObjectID(0),
+    _target(0),
+    _usage(0),
+    _dirty(true),
+    _totalSize(0),
+    _bufferObject(0),
+    _extensions(0)
+{
+    assign(bufferObject);
+    _extensions = GLBufferObject::getExtensions(contextID, true);
+    _extensions->glGenBuffers(1, &_glObjectID);
+}
+
+GLBufferObject::~GLBufferObject()
+{
+    if (_glObjectID!=0) GLBufferObject::deleteBufferObject(_contextID, _glObjectID);
+
+}
+
+void GLBufferObject::assign(BufferObject* bufferObject)
+{
+    _bufferObject = bufferObject;
+
+    if (_bufferObject)
+    {
+        _target = bufferObject->getTarget();
+        _usage = bufferObject->getUsage();
+
+        _totalSize = 0;
+
+        _dirty = true;
+
+        _bufferEntries.clear();
+    }
+    else
+    {
+        _target = 0;
+        _usage = 0;
+
+        _totalSize = 0;
+
+        // clear all previous entries;
+        _bufferEntries.clear();
+    }
+}
+
+void GLBufferObject::clear()
+{
+    _bufferEntries.clear();
+    _dirty = true;
+}
+
+void GLBufferObject::compileBuffer()
+{
+    _dirty = false;
+
+    _bufferEntries.reserve(_bufferObject->getNumBufferData());
+
+    _totalSize = 0;
+
+    bool compileAll = false;
+    bool offsetChanged = false;
+
+    GLsizeiptrARB newTotalSize = 0;
+    unsigned int i=0;
+    for(; i<_bufferObject->getNumBufferData(); ++i)
+    {
+        BufferData* bd = _bufferObject->getBufferData(i);
+        if (i<_bufferEntries.size())
+        {
+            BufferEntry& entry = _bufferEntries[i];
+            if (offsetChanged ||
+                entry.dataSource != bd ||
+                entry.dataSize != bd->getTotalDataSize())
+            {
+                GLsizeiptrARB previousEndOfBufferDataMarker = GLsizeiptrARB(entry.offset) + entry.dataSize;
+
+                // osg::notify(osg::NOTICE)<<"GLBufferObject::compileBuffer(..) updating BufferEntry"<<std::endl;
+
+
+                entry.offset = newTotalSize;
+                entry.modifiedCount = 0xffffff;
+                entry.dataSize = bd->getTotalDataSize();
+                entry.dataSource = bd;
+
+                newTotalSize += entry.dataSize;
+                if (previousEndOfBufferDataMarker==newTotalSize)
+                {
+                    offsetChanged = true;
+                }
+            }
+        }
+        else
+        {
+            BufferEntry entry;
+            entry.offset = newTotalSize;
+            entry.modifiedCount = 0xffffff;
+            entry.dataSize = bd->getTotalDataSize();
+            entry.dataSource = bd;
+#if 0
+            osg::notify(osg::NOTICE)<<"entry"<<std::endl;
+            osg::notify(osg::NOTICE)<<"   offset "<<entry.offset<<std::endl;
+            osg::notify(osg::NOTICE)<<"   dataSize "<<entry.dataSize<<std::endl;
+            osg::notify(osg::NOTICE)<<"   dataSource "<<entry.dataSource<<std::endl;
+            osg::notify(osg::NOTICE)<<"   modifiedCount "<<entry.modifiedCount<<std::endl;
+#endif
+            newTotalSize += entry.dataSize;
+
+            _bufferEntries.push_back(entry);
+        }
+    }
+
+    if (i<_bufferEntries.size())
+    {
+        // triming end of bufferEntries as the source data is has less entries than the originally held.
+        _bufferEntries.erase(_bufferEntries.begin()+i, _bufferEntries.end());
+    }
+
+    _extensions->glBindBuffer(_target, _glObjectID);
+
+    if (newTotalSize != _totalSize)
+    {
+        _totalSize = newTotalSize;
+        _extensions->glBufferData(_target, _totalSize, NULL, _usage);
+    }
+
+    char* vboMemory = 0;
+
+#if 0
+    vboMemory = extensions->glMapBuffer(_target, GL_WRITE_ONLY_ARB);
+#endif
+
+    for(BufferEntries::iterator itr = _bufferEntries.begin();
+        itr != _bufferEntries.end();
+        ++itr)
+    {
+        BufferEntry& entry = *itr;
+        if (compileAll || entry.modifiedCount != entry.dataSource->getModifiedCount())
+        {
+            // osg::notify(osg::NOTICE)<<"GLBufferObject::compileBuffer(..) downloading BufferEntry "<<&entry<<std::endl;
+            entry.modifiedCount = entry.dataSource->getModifiedCount();
+
+            if (vboMemory)
+                memcpy(vboMemory + (GLsizeiptrARB)entry.offset, entry.dataSource->getDataPointer(), entry.dataSize);
+            else
+                _extensions->glBufferSubData(_target, (GLintptrARB)entry.offset, (GLsizeiptrARB)entry.dataSize, entry.dataSource->getDataPointer());
+
+        }
+    }
+
+    // Unmap the texture image buffer
+    if (vboMemory) _extensions->glUnmapBuffer(_target);
+}
+
+GLBufferObject* GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject)
+{
+    return new GLBufferObject(contextID, const_cast<BufferObject*>(bufferObject));
+}
+
+void GLBufferObject::deleteGLObject()
+{
+    if (_glObjectID!=0)
+    {
+        _extensions->glDeleteBuffers(1, &_glObjectID);
+        _glObjectID = 0;
+
+        _totalSize = 0;
+        _bufferEntries.clear();
+    }
+}
+
+
+void GLBufferObject::deleteBufferObject(unsigned int contextID,GLuint globj)
 {
     if (globj!=0)
@@ -49,5 +227,5 @@
 }
 
-void BufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime)
+void GLBufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime)
 {
     // if no time available don't try to flush objects.
@@ -85,5 +263,5 @@
 }
 
-void BufferObject::discardDeletedBufferObjects(unsigned int contextID)
+void GLBufferObject::discardDeletedBufferObjects(unsigned int contextID)
 {
     OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedBufferObjectCache);
@@ -92,51 +270,4 @@
 }
 
-
-BufferObject::BufferObject():
-    _target(0),
-    _usage(0),
-    _totalSize(0)
-{
-}
-
-BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
-    Object(bo,copyop)
-{
-}
-
-BufferObject::~BufferObject()
-{
-    releaseGLObjects(0);
-}
-
-void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
-{
-    _bufferObjectList.resize(maxSize);
-}
-
-void BufferObject::releaseGLObjects(State* state) const
-{
-    if (state)
-    {
-        unsigned int contextID = state->getContextID();
-        if (_bufferObjectList[contextID])
-        {
-             deleteBufferObject(contextID,_bufferObjectList[contextID]);
-            _bufferObjectList[contextID] = 0;
-        }
-    }
-    else
-    {
-        for(unsigned int contextID=0;contextID<_bufferObjectList.size();++contextID)
-        {
-            if (_bufferObjectList[contextID])
-            {
-                 deleteBufferObject(contextID,_bufferObjectList[contextID]);
-                _bufferObjectList[contextID] = 0;
-            }
-        }
-    }
-}
-
 //////////////////////////////////////////////////////////////////////////////
 //
@@ -144,24 +275,24 @@
 //
 
-typedef buffered_value< ref_ptr<BufferObject::Extensions> > BufferedExtensions;
+typedef buffered_value< ref_ptr<GLBufferObject::Extensions> > BufferedExtensions;
 static BufferedExtensions s_extensions;
 
-BufferObject::Extensions* BufferObject::getExtensions(unsigned int contextID,bool createIfNotInitalized)
-{
-    if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new BufferObject::Extensions(contextID);
+GLBufferObject::Extensions* GLBufferObject::getExtensions(unsigned int contextID,bool createIfNotInitalized)
+{
+    if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new GLBufferObject::Extensions(contextID);
     return s_extensions[contextID].get();
 }
 
-void BufferObject::setExtensions(unsigned int contextID,Extensions* extensions)
+void GLBufferObject::setExtensions(unsigned int contextID,Extensions* extensions)
 {
     s_extensions[contextID] = extensions;
 }
 
-BufferObject::Extensions::Extensions(unsigned int contextID)
+GLBufferObject::Extensions::Extensions(unsigned int contextID)
 {
     setupGLExtensions(contextID);
 }
 
-BufferObject::Extensions::Extensions(const Extensions& rhs):
+GLBufferObject::Extensions::Extensions(const Extensions& rhs):
     Referenced()
 {
@@ -180,5 +311,5 @@
 
 
-void BufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
+void GLBufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
 {
     if (!rhs._glGenBuffers) _glGenBuffers = rhs._glGenBuffers;
@@ -195,5 +326,5 @@
 }
 
-void BufferObject::Extensions::setupGLExtensions(unsigned int contextID)
+void GLBufferObject::Extensions::setupGLExtensions(unsigned int contextID)
 {
     setGLExtensionFuncPtr(_glGenBuffers, "glGenBuffers","glGenBuffersARB");
@@ -211,5 +342,5 @@
 }
 
-void BufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
+void GLBufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
 {
     if (_glGenBuffers) _glGenBuffers(n, buffers);
@@ -217,5 +348,5 @@
 }
 
-void BufferObject::Extensions::glBindBuffer(GLenum target, GLuint buffer) const
+void GLBufferObject::Extensions::glBindBuffer(GLenum target, GLuint buffer) const
 {
     if (_glBindBuffer) _glBindBuffer(target, buffer);
@@ -223,5 +354,5 @@
 }
 
-void BufferObject::Extensions::glBufferData(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const
+void GLBufferObject::Extensions::glBufferData(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const
 {
     if (_glBufferData) _glBufferData(target, size, data, usage);
@@ -229,5 +360,5 @@
 }
 
-void BufferObject::Extensions::glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const
+void GLBufferObject::Extensions::glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const
 {
     if (_glBufferSubData) _glBufferSubData(target, offset, size, data);
@@ -235,5 +366,5 @@
 }
 
-void BufferObject::Extensions::glDeleteBuffers(GLsizei n, const GLuint *buffers) const
+void GLBufferObject::Extensions::glDeleteBuffers(GLsizei n, const GLuint *buffers) const
 {
     if (_glDeleteBuffers) _glDeleteBuffers(n, buffers);
@@ -241,5 +372,5 @@
 }
 
-GLboolean BufferObject::Extensions::glIsBuffer (GLuint buffer) const
+GLboolean GLBufferObject::Extensions::glIsBuffer (GLuint buffer) const
 {
     if (_glIsBuffer) return _glIsBuffer(buffer);
@@ -251,5 +382,5 @@
 }
 
-void BufferObject::Extensions::glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const
+void GLBufferObject::Extensions::glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const
 {
     if (_glGetBufferSubData) _glGetBufferSubData(target,offset,size,data);
@@ -257,5 +388,5 @@
 }
 
-GLvoid* BufferObject::Extensions::glMapBuffer (GLenum target, GLenum access) const
+GLvoid* GLBufferObject::Extensions::glMapBuffer (GLenum target, GLenum access) const
 {
     if (_glMapBuffer) return _glMapBuffer(target,access);
@@ -267,5 +398,5 @@
 }
 
-GLboolean BufferObject::Extensions::glUnmapBuffer (GLenum target) const
+GLboolean GLBufferObject::Extensions::glUnmapBuffer (GLenum target) const
 {
     if (_glUnmapBuffer) return _glUnmapBuffer(target);
@@ -277,5 +408,5 @@
 }
 
-void BufferObject::Extensions::glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const
+void GLBufferObject::Extensions::glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const
 {
     if (_glGetBufferParameteriv) _glGetBufferParameteriv(target,pname,params);
@@ -283,8 +414,139 @@
 }
 
-void BufferObject::Extensions::glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const
+void GLBufferObject::Extensions::glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const
 {
     if (_glGetBufferPointerv) _glGetBufferPointerv(target,pname,params);
     else notify(WARN)<<"Error: glGetBufferPointerv not supported by OpenGL driver"<<std::endl;
+}
+
+#if 1
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// BufferObject
+//
+BufferObject::BufferObject():
+    _target(0),
+    _usage(0)
+{
+}
+
+BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
+    Object(bo,copyop)
+{
+}
+
+BufferObject::~BufferObject()
+{
+    releaseGLObjects(0);
+}
+
+void BufferObject::setBufferData(unsigned int index, BufferData* bd)
+{
+    if (index>=_bufferDataList.size()) _bufferDataList.resize(index+1);
+    _bufferDataList[index] = bd;
+}
+
+void BufferObject::dirty()
+{
+    for(unsigned int i=0; i<_glBufferObjects.size(); ++i)
+    {
+        if (_glBufferObjects[i].valid()) _glBufferObjects[i]->dirty();
+    }
+}
+
+void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
+{
+    _glBufferObjects.resize(maxSize);
+}
+
+void BufferObject::releaseGLObjects(State* state) const
+{
+    if (state)
+    {
+        _glBufferObjects[state->getContextID()] = 0;
+    }
+    else
+    {
+        _glBufferObjects.clear();
+    }
+}
+
+unsigned int BufferObject::addBufferData(BufferData* bd)
+{
+    if (!bd) return 0;
+
+    // check to see if bd exists in BufferObject already, is so return without doing anything
+    for(BufferDataList::iterator itr = _bufferDataList.begin();
+        itr != _bufferDataList.end();
+        ++itr)
+    {
+        if (*itr == bd) return bd->getBufferIndex();
+    }
+
+    // bd->setBufferIndex(_bufferDataList.size());
+
+    _bufferDataList.push_back(bd);
+
+    // osg::notify(osg::NOTICE)<<"BufferObject "<<this<<":"<<className()<<"::addBufferData("<<bd<<"), bufferIndex= "<<_bufferDataList.size()-1<<std::endl;
+
+    return _bufferDataList.size()-1;
+}
+
+void BufferObject::removeBufferData(unsigned int index)
+{
+    if (index>=_bufferDataList.size())
+    {
+        osg::notify(osg::WARN)<<"Error "<<className()<<"::removeBufferData("<<index<<") out of range."<<std::endl;
+        return;
+    }
+
+    // osg::notify(osg::NOTICE)<<"BufferObject::"<<this<<":"<<className()<<"::removeBufferData("<<index<<"), size= "<<_bufferDataList.size()<<std::endl;
+
+    // alter the indices of the BufferData after the entry to be removed so their indices are correctly placed.
+    for(unsigned int i=index+1; i<_bufferDataList.size(); ++i)
+    {
+        _bufferDataList[i]->setBufferIndex(i-1);
+    }
+
+    // remove the entry
+    _bufferDataList.erase(_bufferDataList.begin() + index);
+
+    for(unsigned int i=0; i<_glBufferObjects.size(); ++i)
+    {
+        if (_glBufferObjects[i].valid()) _glBufferObjects[i]->clear();
+    }
+
+}
+
+void BufferObject::removeBufferData(BufferData* bd)
+{
+    // osg::notify(osg::NOTICE)<<"BufferObject::"<<this<<":"<<className()<<"::removeBufferData("<<bd<<"), index="<<bd->getBufferIndex()<<" size= "<<_bufferDataList.size()<<std::endl;
+
+    if (!bd || bd->getBufferObject()!=this) return;
+
+    removeBufferData(bd->getBufferIndex());
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// BufferData
+//
+BufferData::~BufferData()
+{
+    setBufferObject(0);
+}
+
+void BufferData::setBufferObject(BufferObject* bufferObject)
+{
+    if (_bufferObject==bufferObject) return;
+
+    if (_bufferObject.valid())
+    {
+        _bufferObject->removeBufferData(_bufferIndex);
+    }
+
+    _bufferObject = bufferObject;
+    _bufferIndex = _bufferObject.valid() ? _bufferObject->addBufferData(this) : 0;
 }
 
@@ -312,38 +574,27 @@
 unsigned int VertexBufferObject::addArray(osg::Array* array)
 {
-    unsigned int i = _bufferEntryArrayPairs.size();
-
-    _bufferEntryArrayPairs.resize(i+1);
-    _bufferEntryArrayPairs[i].second = array;
-    _bufferEntryArrayPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
-    _bufferEntryArrayPairs[i].first.offset = 0;
-
-    dirty();
-
-    return i;
+    return addBufferData(array);
 }
 
 void VertexBufferObject::removeArray(osg::Array* array)
 {
-    BufferEntryArrayPairs::iterator itr;
-    for(itr = _bufferEntryArrayPairs.begin();
-        itr != _bufferEntryArrayPairs.end();
-        ++itr)
-    {
-        if (itr->second == array) break;
-    }
-    if (itr != _bufferEntryArrayPairs.end()) _bufferEntryArrayPairs.erase(itr);
+    removeBufferData(array);
 }
 
 void VertexBufferObject::setArray(unsigned int i, Array* array)
 {
-    if (i+1>=_bufferEntryArrayPairs.size()) _bufferEntryArrayPairs.resize(i+1);
-
-    _bufferEntryArrayPairs[i].second = array;
-    _bufferEntryArrayPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
-    _bufferEntryArrayPairs[i].first.offset = 0;
-
-    dirty();
-}
+    setBufferData(i,array);
+}
+
+Array* VertexBufferObject::getArray(unsigned int i)
+{
+    return dynamic_cast<osg::Array*>(getBufferData(i));
+}
+
+const Array* VertexBufferObject::getArray(unsigned int i) const
+{
+    return dynamic_cast<const osg::Array*>(getBufferData(i));
+}
+#if 0
 void VertexBufferObject::compileBuffer(State& state) const
 {
@@ -515,16 +766,5 @@
 //    osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
 }
-
-void VertexBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
-{
-    BufferObject::resizeGLObjectBuffers(maxSize);
-
-    for(BufferEntryArrayPairs::iterator itr = _bufferEntryArrayPairs.begin();
-        itr != _bufferEntryArrayPairs.end();
-        ++itr)
-    {
-        itr->first.modifiedCount.resize(maxSize);
-    }
-}
+#endif
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -549,34 +789,29 @@
 unsigned int ElementBufferObject::addDrawElements(osg::DrawElements* drawElements)
 {
-    unsigned int i = _bufferEntryDrawElementsPairs.size();
-    _bufferEntryDrawElementsPairs.resize(i+1);
-    _bufferEntryDrawElementsPairs[i].second = drawElements;
-    _bufferEntryDrawElementsPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
-    _bufferEntryDrawElementsPairs[i].first.dataSize = 0;
-
-    return i;
+    return addBufferData(drawElements);
 }
 
 void ElementBufferObject::removeDrawElements(osg::DrawElements* drawElements)
 {
-    BufferEntryDrawElementsPairs::iterator itr;
-    for(itr = _bufferEntryDrawElementsPairs.begin();
-        itr != _bufferEntryDrawElementsPairs.end();
-        ++itr)
-    {
-        if (itr->second == drawElements) break;
-    }
-    if (itr != _bufferEntryDrawElementsPairs.end()) _bufferEntryDrawElementsPairs.erase(itr);
+    removeBufferData(drawElements);
 }
 
 void ElementBufferObject::setDrawElements(unsigned int i, DrawElements* drawElements)
 {
-    if (i+1>=_bufferEntryDrawElementsPairs.size()) _bufferEntryDrawElementsPairs.resize(i+1);
-
-    _bufferEntryDrawElementsPairs[i].second = drawElements;
-    _bufferEntryDrawElementsPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
-    _bufferEntryDrawElementsPairs[i].first.dataSize = 0;
-}
-
+    setBufferData(i,drawElements);
+}
+
+DrawElements* ElementBufferObject::getDrawElements(unsigned int i)
+{
+    return dynamic_cast<DrawElements*>(getBufferData(i));
+}
+
+const DrawElements* ElementBufferObject::getDrawElements(unsigned int i) const
+{
+    return dynamic_cast<const DrawElements*>(getBufferData(i));
+}
+
+
+#if 0
 void ElementBufferObject::compileBuffer(State& state) const
 {
@@ -682,16 +917,5 @@
 //    osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
 }
-
-void ElementBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
-{
-    BufferObject::resizeGLObjectBuffers(maxSize);
-
-    for(BufferEntryDrawElementsPairs::iterator itr = _bufferEntryDrawElementsPairs.begin();
-        itr != _bufferEntryDrawElementsPairs.end();
-        ++itr)
-    {
-        itr->first.modifiedCount.resize(maxSize);
-    }
-}
+#endif
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -704,11 +928,12 @@
     _target = GL_PIXEL_UNPACK_BUFFER_ARB;
     _usage = GL_STREAM_DRAW_ARB;
-    _bufferEntryImagePair.second = image;
-}
-
-/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
+
+    osg::notify(osg::NOTICE)<<"Constructing PixelBufferObject for image="<<image<<std::endl;
+
+    setBufferData(0, image);
+}
+
 PixelBufferObject::PixelBufferObject(const PixelBufferObject& buffer,const CopyOp& copyop):
-    BufferObject(buffer,copyop),
-    _bufferEntryImagePair(buffer._bufferEntryImagePair)
+    BufferObject(buffer,copyop)
 {
 }
@@ -720,10 +945,18 @@
 void PixelBufferObject::setImage(osg::Image* image)
 {
-    if (_bufferEntryImagePair.second == image) return;
-
-    _bufferEntryImagePair.second = image;
-
-    dirty();
-}
+    setBufferData(0, image);
+}
+
+Image* PixelBufferObject::getImage()
+{
+    return dynamic_cast<Image*>(getBufferData(0));
+}
+
+const Image* PixelBufferObject::getImage() const
+{
+    return dynamic_cast<const Image*>(getBufferData(0));
+}
+
+#if 0
 void PixelBufferObject::compileBuffer(State& state) const
 {
@@ -782,12 +1015,5 @@
 //    osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
 }
-
-void PixelBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
-{
-    BufferObject::resizeGLObjectBuffers(maxSize);
-
-    _bufferEntryImagePair.first.modifiedCount.resize(maxSize);
-}
-
+#endif
 
 //////////////////////////////////////////////////////////////////////////////////
@@ -800,11 +1026,9 @@
     _target = GL_ARRAY_BUFFER_ARB;
     _usage = GL_DYNAMIC_DRAW_ARB;
-    _bufferData.dataSize = 0;
 }
 
 //--------------------------------------------------------------------------------
 PixelDataBufferObject::PixelDataBufferObject(const PixelDataBufferObject& buffer,const CopyOp& copyop):
-    BufferObject(buffer,copyop),
-    _bufferData(buffer._bufferData)
+    BufferObject(buffer,copyop)
 {
 }
@@ -819,19 +1043,12 @@
 {
     unsigned int contextID = state.getContextID();    
-    if (!isDirty(contextID) || _bufferData.dataSize == 0) return;
-
-    Extensions* extensions = getExtensions(contextID,true);
-
-    GLuint& pbo = buffer(contextID);
-    if (pbo == 0)
-    {
-        extensions->glGenBuffers(1, &pbo);
-    }
-
-    extensions->glBindBuffer(_target, pbo);
-    extensions->glBufferData(_target, _bufferData.dataSize, NULL, _usage);
-    extensions->glBindBuffer(_target, 0);
-
-    _compiledList[contextID] = 1;
+    if ( _dataSize == 0) return;
+
+    GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
+    if (!bo || !bo->isDirty()) return;
+
+    bo->_extensions->glBindBuffer(_target, bo->getGLObjectID());
+    bo->_extensions->glBufferData(_target, _dataSize, NULL, _usage);
+    bo->_extensions->glBindBuffer(_target, 0);
 }
 
@@ -840,9 +1057,12 @@
 {
     unsigned int contextID = state.getContextID();    
-    if (isDirty(contextID)) compileBuffer(state);
-
-    Extensions* extensions = getExtensions(contextID,true);
-
-    extensions->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, buffer(contextID));
+
+    GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
+    if (!bo) return;
+
+    if (bo->isDirty()) compileBuffer(state);
+
+    bo->_extensions->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, bo->getGLObjectID());
+
     _mode[contextID] = READ;
 }
@@ -852,9 +1072,12 @@
 {
     unsigned int contextID = state.getContextID();    
-    if (isDirty(contextID)) compileBuffer(state);
-
-    Extensions* extensions = getExtensions(contextID,true);
-
-    extensions->glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer(contextID));
+
+    GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
+    if (!bo) return;
+
+    if (bo->isDirty()) compileBuffer(state);
+
+    bo->_extensions->glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, bo->getGLObjectID());
+
     _mode[contextID] = WRITE;
 }
@@ -863,5 +1086,5 @@
 void PixelDataBufferObject::unbindBuffer(unsigned int contextID) const
 { 
-    Extensions* extensions = getExtensions(contextID,true);
+    GLBufferObject::Extensions* extensions = GLBufferObject::getExtensions(contextID,true);
 
     switch(_mode[contextID])
@@ -889,2 +1112,4 @@
 }
 
+
+#endif
Index: /OpenSceneGraph/trunk/src/osg/PrimitiveSet.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/PrimitiveSet.cpp (revision 9796)
+++ /OpenSceneGraph/trunk/src/osg/PrimitiveSet.cpp (revision 10600)
@@ -127,10 +127,10 @@
     if (useVertexBufferObjects)
     {
-        const ElementBufferObject* ebo = getElementBufferObject();
+        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
         state.bindElementBufferObject(ebo);
         if (ebo)
         {
-            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset(), _numInstances);
-            else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset());
+            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
+            else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
         }
         else
@@ -177,10 +177,10 @@
     if (useVertexBufferObjects)
     {
-        const ElementBufferObject* ebo = getElementBufferObject();
+        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
         state.bindElementBufferObject(ebo);
         if (ebo)
         {
-            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset(), _numInstances);
-            else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset());
+            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
+            else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
         }
         else
@@ -227,10 +227,10 @@
     if (useVertexBufferObjects)
     {
-        const ElementBufferObject* ebo = getElementBufferObject();
+        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
         state.bindElementBufferObject(ebo);
         if (ebo)
         {
-            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset(), _numInstances);
-            else glDrawElements(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset());
+            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
+            else glDrawElements(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
         }
         else
Index: /OpenSceneGraph/trunk/src/osg/Image.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/Image.cpp (revision 10062)
+++ /OpenSceneGraph/trunk/src/osg/Image.cpp (revision 10600)
@@ -34,5 +34,5 @@
 
 Image::Image()
-    :Object(true),
+    :BufferData(),
     _fileName(""),
     _writeHint(NO_PREFERENCE),
@@ -45,6 +45,5 @@
     _pixelAspectRatio(1.0),
     _allocationMode(USE_NEW_DELETE),
-    _data(0L),
-    _modifiedCount(0)
+    _data(0L)
 {
     setDataVariance(STATIC); 
@@ -52,5 +51,5 @@
 
 Image::Image(const Image& image,const CopyOp& copyop):
-    Object(image,copyop),
+    BufferData(image,copyop),
     _fileName(image._fileName),
     _writeHint(image._writeHint),
@@ -63,5 +62,4 @@
     _pixelAspectRatio(image._pixelAspectRatio),
     _data(0L),
-    _modifiedCount(image._modifiedCount),
     _mipmapData(image._mipmapData)
 {
Index: /OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp (revision 10596)
+++ /OpenSceneGraph/trunk/src/osg/TextureRectangle.cpp (revision 10600)
@@ -1,3 +1,3 @@
-/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
+/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  *
  * This library is open source and may be redistributed and/or modified under  
@@ -291,17 +291,10 @@
     }
 
-    unsigned char* dataMinusOffset = 0;
-    unsigned char* dataPlusOffset = 0;
-
-    const PixelBufferObject* pbo = image->getPixelBufferObject();
-    if (pbo && pbo->isPBOSupported(contextID))
+    const unsigned char* dataPtr = image->data();
+    GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
+    if (pbo)
     {
         state.bindPixelBufferObject(pbo);
-        dataMinusOffset = image->data();
-        dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
-    }
-    else
-    {
-        pbo = 0;
+        dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
     }
 
@@ -311,5 +304,5 @@
           image->s(), image->t(), 0,
           image->getImageSizeInBytes(), 
-          image->data() - dataMinusOffset + dataPlusOffset);                
+          dataPtr);
     }
     else
@@ -319,5 +312,5 @@
           (GLenum)image->getPixelFormat(),
           (GLenum)image->getDataType(),
-          image->data() - dataMinusOffset + dataPlusOffset );
+          dataPtr );
     }
     
@@ -366,24 +359,19 @@
 #ifdef DO_TIMING
     osg::Timer_t start_tick = osg::Timer::instance()->tick();
-    osg::notify(osg::NOTICE)<<"glTexSubImage2D pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
+    osg::notify(osg::NOTICE)<<"TextureRectangle::apply pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
 #endif
-    unsigned char* dataMinusOffset = 0;
-    unsigned char* dataPlusOffset = 0;
-
-    const PixelBufferObject* pbo = image->getPixelBufferObject();
-    if (pbo && pbo->isPBOSupported(contextID))
+    const unsigned char* dataPtr = image->data();
+    GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
+    if (pbo)
     {
         state.bindPixelBufferObject(pbo);
-        dataMinusOffset = image->data();
-        dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); // -dataMinusOffset+dataPlusOffset
-
+        dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
 #ifdef DO_TIMING
         osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
 #endif
-
     }
     else
     {
-        pbo = 0;
+        osg::notify(osg::NOTICE)<<"    no PixelBufferObject "<<image->getBufferObject()<<", "<<image->getPixelBufferObject()<<" pbo="<<pbo<<std::endl;
     }
     
@@ -396,5 +384,5 @@
           (GLenum)image->getPixelFormat(),
           (GLenum)image->getDataType(),
-          image->data() - dataMinusOffset + dataPlusOffset);                
+          dataPtr);
     }
     else
@@ -405,5 +393,5 @@
           (GLenum)image->getPixelFormat(),
           (GLenum)image->getDataType(),
-          image->data() - dataMinusOffset + dataPlusOffset  );
+          dataPtr);
     }
 
@@ -416,5 +404,4 @@
     osg::notify(osg::NOTICE)<<"glTexSubImage2D "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
 #endif
-    
 }
 
Index: /OpenSceneGraph/trunk/src/osg/GLObjects.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/GLObjects.cpp (revision 7821)
+++ /OpenSceneGraph/trunk/src/osg/GLObjects.cpp (revision 10600)
@@ -24,5 +24,5 @@
 void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime)
 {
-    osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
+    osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
     osg::Drawable::flushDeletedDisplayLists(contextID,availableTime);
     osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
@@ -40,5 +40,5 @@
     double currentTime = DBL_MAX;
     double availableTime = DBL_MAX;
-    osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
+    osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
     osg::Drawable::flushAllDeletedDisplayLists(contextID);
     osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
@@ -54,5 +54,5 @@
 void osg::discardAllDeletedGLObjects(unsigned int contextID)
 {
-    osg::BufferObject::discardDeletedBufferObjects(contextID);
+    osg::GLBufferObject::discardDeletedBufferObjects(contextID);
     osg::Drawable::discardAllDeletedDisplayLists(contextID);
     osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID);
Index: /OpenSceneGraph/trunk/src/osg/Geometry.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osg/Geometry.cpp (revision 9900)
+++ /OpenSceneGraph/trunk/src/osg/Geometry.cpp (revision 10600)
@@ -1375,4 +1375,5 @@
         if (usingVertexBufferObjects)
         {
+            // osg::notify(osg::NOTICE)<<"Geometry::drawImplementation() Using VertexBufferObjects"<<std::endl;
 
             //
@@ -1417,5 +1418,4 @@
                 }
                 state.disableVertexAttribPointersAboveAndIncluding( index );
-                
             }
             else if (vertexVertexAttributesSupported)
@@ -1430,5 +1430,5 @@
         else
         {
-            //std::cout << "none VertexBuffer path"<<std::endl;
+            // osg::notify(osg::NOTICE)<<"none VertexBuffer path"<<std::endl;
 
             //
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUByte.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUByte.cpp (revision 7648)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUByte.cpp (revision 10600)
@@ -34,5 +34,5 @@
     // Write array length and its elements.
     out->writeInt(size());
-    out->writeCharArray((const char*)&front(), size() * CHARSIZE);
+    if (size()!=0) out->writeCharArray((const char*)&front(), size() * CHARSIZE);
 }
 
@@ -54,5 +54,5 @@
         int size = in->readInt();
         resize(size);
-        in->readCharArray((char*)&front(), size * CHARSIZE);
+        if (size!=0) in->readCharArray((char*)&front(), size * CHARSIZE);
 
     }
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUShort.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUShort.cpp (revision 7648)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUShort.cpp (revision 10600)
@@ -35,5 +35,5 @@
     // Write array length and its elements.
     out->writeInt(size());
-    out->writeCharArray((const char*)&front(), size() * SHORTSIZE);
+    if (size()!=0) out->writeCharArray((const char*)&front(), size() * SHORTSIZE);
 }
 
Index: /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUInt.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUInt.cpp (revision 7648)
+++ /OpenSceneGraph/trunk/src/osgPlugins/ive/DrawElementsUInt.cpp (revision 10600)
@@ -35,5 +35,5 @@
     // Write array length and its elements.
     out->writeInt(size());
-    out->writeCharArray((const char*)&front(), size() * INTSIZE);
+    if (size()!=0) out->writeCharArray((const char*)&front(), size() * INTSIZE);
 }
 
@@ -56,5 +56,5 @@
         int size = in->readInt();
         resize(size);
-        in->readCharArray((char*)&front(), size * INTSIZE);
+        if (size!=0) in->readCharArray((char*)&front(), size * INTSIZE);
 
         if (in->_byteswap)
Index: /OpenSceneGraph/trunk/src/osgViewer/ScreenCaptureHandler.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgViewer/ScreenCaptureHandler.cpp (revision 9416)
+++ /OpenSceneGraph/trunk/src/osgViewer/ScreenCaptureHandler.cpp (revision 10600)
@@ -74,6 +74,6 @@
             void read();            
             void readPixels();
-            void singlePBO(osg::BufferObject::Extensions* ext);
-            void multiPBO(osg::BufferObject::Extensions* ext);
+            void singlePBO(osg::GLBufferObject::Extensions* ext);
+            void multiPBO(osg::GLBufferObject::Extensions* ext);
 
             typedef std::vector< osg::ref_ptr<osg::Image> >             ImageBuffer;
@@ -221,5 +221,5 @@
 void WindowCaptureCallback::ContextData::read()
 {
-    osg::BufferObject::Extensions* ext = osg::BufferObject::getExtensions(_gc->getState()->getContextID(),true);
+    osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions(_gc->getState()->getContextID(),true);
 
     if (ext->isPBOSupported() && !_pboBuffer.empty())
@@ -278,5 +278,5 @@
 }
 
-void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions* ext)
+void WindowCaptureCallback::ContextData::singlePBO(osg::GLBufferObject::Extensions* ext)
 {
     unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();
@@ -353,5 +353,5 @@
 }
 
-void WindowCaptureCallback::ContextData::multiPBO(osg::BufferObject::Extensions* ext)
+void WindowCaptureCallback::ContextData::multiPBO(osg::GLBufferObject::Extensions* ext)
 {
     unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();
Index: /OpenSceneGraph/trunk/src/osgWrappers/osg/BufferObject.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/osg/BufferObject.cpp (revision 9775)
+++ /OpenSceneGraph/trunk/src/osgWrappers/osg/BufferObject.cpp (revision 10600)
@@ -27,4 +27,106 @@
 #endif
 
+BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferData)
+	I_DeclaringFile("osg/BufferObject");
+	I_BaseType(osg::Object);
+	I_Constructor0(____BufferData,
+	               "",
+	               "");
+	I_ConstructorWithDefaults2(IN, const osg::BufferData &, bd, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
+	                           ____BufferData__C5_BufferData_R1__C5_CopyOp_R1,
+	                           "Copy constructor using CopyOp to manage deep vs shallow copy. ",
+	                           "");
+	I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
+	          Properties::VIRTUAL,
+	          __bool__isSameKindAs__C5_Object_P1,
+	          "",
+	          "");
+	I_Method0(const char *, libraryName,
+	          Properties::VIRTUAL,
+	          __C5_char_P1__libraryName,
+	          "return the name of the object's library. ",
+	          "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
+	I_Method0(const char *, className,
+	          Properties::VIRTUAL,
+	          __C5_char_P1__className,
+	          "return the name of the object's class type. ",
+	          "Must be defined by derived classes. ");
+	I_Method0(const GLvoid *, getDataPointer,
+	          Properties::PURE_VIRTUAL,
+	          __C5_GLvoid_P1__getDataPointer,
+	          "",
+	          "");
+	I_Method0(unsigned int, getTotalDataSize,
+	          Properties::PURE_VIRTUAL,
+	          __unsigned_int__getTotalDataSize,
+	          "",
+	          "");
+	I_Method1(void, setBufferObject, IN, osg::BufferObject *, bufferObject,
+	          Properties::NON_VIRTUAL,
+	          __void__setBufferObject__BufferObject_P1,
+	          "",
+	          "");
+	I_Method0(osg::BufferObject *, getBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __BufferObject_P1__getBufferObject,
+	          "",
+	          "");
+	I_Method0(const osg::BufferObject *, getBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __C5_BufferObject_P1__getBufferObject,
+	          "",
+	          "");
+	I_Method1(void, setBufferIndex, IN, unsigned int, index,
+	          Properties::NON_VIRTUAL,
+	          __void__setBufferIndex__unsigned_int,
+	          "",
+	          "");
+	I_Method0(unsigned int, getBufferIndex,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__getBufferIndex,
+	          "",
+	          "");
+	I_Method1(osg::GLBufferObject *, getGLBufferObject, IN, unsigned int, contextID,
+	          Properties::NON_VIRTUAL,
+	          __GLBufferObject_P1__getGLBufferObject__unsigned_int,
+	          "",
+	          "");
+	I_Method1(osg::GLBufferObject *, getOrCreateGLBufferObject, IN, unsigned int, contextID,
+	          Properties::NON_VIRTUAL,
+	          __GLBufferObject_P1__getOrCreateGLBufferObject__unsigned_int,
+	          "",
+	          "");
+	I_Method0(void, dirty,
+	          Properties::NON_VIRTUAL,
+	          __void__dirty,
+	          "Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
+	          "");
+	I_Method1(void, setModifiedCount, IN, unsigned int, value,
+	          Properties::NON_VIRTUAL,
+	          __void__setModifiedCount__unsigned_int,
+	          "Set the modified count value. ",
+	          "");
+	I_Method0(unsigned int, getModifiedCount,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__getModifiedCount,
+	          "Get modified count value. ",
+	          "");
+	I_SimpleProperty(unsigned int, BufferIndex, 
+	                 __unsigned_int__getBufferIndex, 
+	                 __void__setBufferIndex__unsigned_int);
+	I_SimpleProperty(osg::BufferObject *, BufferObject, 
+	                 __BufferObject_P1__getBufferObject, 
+	                 __void__setBufferObject__BufferObject_P1);
+	I_SimpleProperty(const GLvoid *, DataPointer, 
+	                 __C5_GLvoid_P1__getDataPointer, 
+	                 0);
+	I_SimpleProperty(unsigned int, ModifiedCount, 
+	                 __unsigned_int__getModifiedCount, 
+	                 __void__setModifiedCount__unsigned_int);
+	I_SimpleProperty(unsigned int, TotalDataSize, 
+	                 __unsigned_int__getTotalDataSize, 
+	                 0);
+END_REFLECTOR
+
 BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
 	I_DeclaringFile("osg/BufferObject");
@@ -52,4 +154,14 @@
 	          "return the name of the object's class type. ",
 	          "Must be defined by derived classes. ");
+	I_Method1(void, setTarget, IN, GLenum, target,
+	          Properties::NON_VIRTUAL,
+	          __void__setTarget__GLenum,
+	          "",
+	          "");
+	I_Method0(GLenum, getTarget,
+	          Properties::NON_VIRTUAL,
+	          __GLenum__getTarget,
+	          "",
+	          "");
 	I_Method1(void, setUsage, IN, GLenum, usage,
 	          Properties::NON_VIRTUAL,
@@ -62,42 +174,7 @@
 	          "Get the type of usage the buffer object has been set up for. ",
 	          "");
-	I_Method1(bool, isBufferObjectSupported, IN, unsigned int, contextID,
-	          Properties::NON_VIRTUAL,
-	          __bool__isBufferObjectSupported__unsigned_int,
-	          "",
-	          "");
-	I_Method1(bool, isPBOSupported, IN, unsigned int, contextID,
-	          Properties::NON_VIRTUAL,
-	          __bool__isPBOSupported__unsigned_int,
-	          "",
-	          "");
-	I_Method1(GLuint &, buffer, IN, unsigned int, contextID,
-	          Properties::NON_VIRTUAL,
-	          __GLuint_R1__buffer__unsigned_int,
-	          "",
-	          "");
-	I_Method1(void, bindBuffer, IN, unsigned int, contextID,
-	          Properties::NON_VIRTUAL,
-	          __void__bindBuffer__unsigned_int,
-	          "",
-	          "");
-	I_Method1(void, unbindBuffer, IN, unsigned int, contextID,
-	          Properties::VIRTUAL,
-	          __void__unbindBuffer__unsigned_int,
-	          "",
-	          "");
 	I_Method0(void, dirty,
 	          Properties::NON_VIRTUAL,
 	          __void__dirty,
-	          "",
-	          "");
-	I_Method1(bool, isDirty, IN, unsigned int, contextID,
-	          Properties::NON_VIRTUAL,
-	          __bool__isDirty__unsigned_int,
-	          "",
-	          "");
-	I_Method1(void, compileBuffer, IN, osg::State &, state,
-	          Properties::PURE_VIRTUAL,
-	          __void__compileBuffer__State_R1,
 	          "",
 	          "");
@@ -112,4 +189,216 @@
 	                      "If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
 	                      "Otherwise, releases OpenGL objects for all graphics contexts. ");
+	I_Method1(unsigned int, addBufferData, IN, osg::BufferData *, bd,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__addBufferData__BufferData_P1,
+	          "",
+	          "");
+	I_Method1(void, removeBufferData, IN, unsigned int, index,
+	          Properties::NON_VIRTUAL,
+	          __void__removeBufferData__unsigned_int,
+	          "",
+	          "");
+	I_Method1(void, removeBufferData, IN, osg::BufferData *, bd,
+	          Properties::NON_VIRTUAL,
+	          __void__removeBufferData__BufferData_P1,
+	          "",
+	          "");
+	I_Method2(void, setBufferData, IN, unsigned int, index, IN, osg::BufferData *, bd,
+	          Properties::NON_VIRTUAL,
+	          __void__setBufferData__unsigned_int__BufferData_P1,
+	          "",
+	          "");
+	I_Method1(osg::BufferData *, getBufferData, IN, unsigned int, index,
+	          Properties::NON_VIRTUAL,
+	          __BufferData_P1__getBufferData__unsigned_int,
+	          "",
+	          "");
+	I_Method1(const osg::BufferData *, getBufferData, IN, unsigned int, index,
+	          Properties::NON_VIRTUAL,
+	          __C5_BufferData_P1__getBufferData__unsigned_int,
+	          "",
+	          "");
+	I_Method0(unsigned int, getNumBufferData,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__getNumBufferData,
+	          "",
+	          "");
+	I_Method1(osg::GLBufferObject *, getGLBufferObject, IN, unsigned int, contextID,
+	          Properties::NON_VIRTUAL,
+	          __GLBufferObject_P1__getGLBufferObject__unsigned_int,
+	          "",
+	          "");
+	I_Method1(osg::GLBufferObject *, getOrCreateGLBufferObject, IN, unsigned int, contextID,
+	          Properties::NON_VIRTUAL,
+	          __GLBufferObject_P1__getOrCreateGLBufferObject__unsigned_int,
+	          "",
+	          "");
+	I_ArrayProperty(osg::BufferData *, BufferData, 
+	                __BufferData_P1__getBufferData__unsigned_int, 
+	                __void__setBufferData__unsigned_int__BufferData_P1, 
+	                __unsigned_int__getNumBufferData, 
+	                __unsigned_int__addBufferData__BufferData_P1, 
+	                0, 
+	                __void__removeBufferData__unsigned_int);
+	I_SimpleProperty(GLenum, Target, 
+	                 __GLenum__getTarget, 
+	                 __void__setTarget__GLenum);
+	I_SimpleProperty(GLenum, Usage, 
+	                 __GLenum__getUsage, 
+	                 __void__setUsage__GLenum);
+END_REFLECTOR
+
+BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
+	I_DeclaringFile("osg/BufferObject");
+	I_BaseType(osg::BufferObject);
+	I_Constructor0(____ElementBufferObject,
+	               "",
+	               "");
+	I_ConstructorWithDefaults2(IN, const osg::ElementBufferObject &, pbo, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
+	                           ____ElementBufferObject__C5_ElementBufferObject_R1__C5_CopyOp_R1,
+	                           "Copy constructor using CopyOp to manage deep vs shallow copy. ",
+	                           "");
+	I_Method0(osg::Object *, cloneType,
+	          Properties::VIRTUAL,
+	          __osg_Object_P1__cloneType,
+	          "Clone the type of an object, with Object* return type. ",
+	          "Must be defined by derived classes. ");
+	I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x,
+	          Properties::VIRTUAL,
+	          __osg_Object_P1__clone__C5_osg_CopyOp_R1,
+	          "Clone an object, with Object* return type. ",
+	          "Must be defined by derived classes. ");
+	I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
+	          Properties::VIRTUAL,
+	          __bool__isSameKindAs__C5_osg_Object_P1,
+	          "",
+	          "");
+	I_Method0(const char *, libraryName,
+	          Properties::VIRTUAL,
+	          __C5_char_P1__libraryName,
+	          "return the name of the object's library. ",
+	          "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
+	I_Method0(const char *, className,
+	          Properties::VIRTUAL,
+	          __C5_char_P1__className,
+	          "return the name of the object's class type. ",
+	          "Must be defined by derived classes. ");
+	I_Method1(unsigned int, addDrawElements, IN, osg::DrawElements *, PrimitiveSet,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__addDrawElements__osg_DrawElements_P1,
+	          "",
+	          "");
+	I_Method1(void, removeDrawElements, IN, osg::DrawElements *, PrimitiveSet,
+	          Properties::NON_VIRTUAL,
+	          __void__removeDrawElements__osg_DrawElements_P1,
+	          "",
+	          "");
+	I_Method2(void, setDrawElements, IN, unsigned int, i, IN, osg::DrawElements *, PrimitiveSet,
+	          Properties::NON_VIRTUAL,
+	          __void__setDrawElements__unsigned_int__DrawElements_P1,
+	          "",
+	          "");
+	I_Method1(osg::DrawElements *, getDrawElements, IN, unsigned int, i,
+	          Properties::NON_VIRTUAL,
+	          __DrawElements_P1__getDrawElements__unsigned_int,
+	          "",
+	          "");
+	I_Method1(const osg::DrawElements *, getDrawElements, IN, unsigned int, i,
+	          Properties::NON_VIRTUAL,
+	          __C5_DrawElements_P1__getDrawElements__unsigned_int,
+	          "",
+	          "");
+	I_IndexedProperty(osg::DrawElements *, DrawElements, 
+	                  __DrawElements_P1__getDrawElements__unsigned_int, 
+	                  __void__setDrawElements__unsigned_int__DrawElements_P1, 
+	                  0);
+END_REFLECTOR
+
+BEGIN_OBJECT_REFLECTOR(osg::GLBufferObject)
+	I_DeclaringFile("osg/BufferObject");
+	I_BaseType(osg::Referenced);
+	I_ConstructorWithDefaults2(IN, unsigned int, contextID, , IN, osg::BufferObject *, bufferObject, 0,
+	                           ____GLBufferObject__unsigned_int__BufferObject_P1,
+	                           "",
+	                           "");
+	I_Method1(void, setBufferObject, IN, osg::BufferObject *, bufferObject,
+	          Properties::NON_VIRTUAL,
+	          __void__setBufferObject__BufferObject_P1,
+	          "",
+	          "");
+	I_Method0(osg::BufferObject *, getBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __BufferObject_P1__getBufferObject,
+	          "",
+	          "");
+	I_Method0(unsigned int, getContextID,
+	          Properties::NON_VIRTUAL,
+	          __unsigned_int__getContextID,
+	          "",
+	          "");
+	I_Method0(GLuint &, getGLObjectID,
+	          Properties::NON_VIRTUAL,
+	          __GLuint_R1__getGLObjectID,
+	          "",
+	          "");
+	I_Method0(GLuint, getGLObjectID,
+	          Properties::NON_VIRTUAL,
+	          __GLuint__getGLObjectID,
+	          "",
+	          "");
+	I_Method1(GLsizeiptrARB, getOffset, IN, unsigned int, i,
+	          Properties::NON_VIRTUAL,
+	          __GLsizeiptrARB__getOffset__unsigned_int,
+	          "",
+	          "");
+	I_Method0(void, bindBuffer,
+	          Properties::NON_VIRTUAL,
+	          __void__bindBuffer,
+	          "",
+	          "");
+	I_Method0(void, unbindBuffer,
+	          Properties::NON_VIRTUAL,
+	          __void__unbindBuffer,
+	          "",
+	          "");
+	I_Method0(bool, isDirty,
+	          Properties::NON_VIRTUAL,
+	          __bool__isDirty,
+	          "",
+	          "");
+	I_Method0(void, dirty,
+	          Properties::NON_VIRTUAL,
+	          __void__dirty,
+	          "",
+	          "");
+	I_Method0(void, clear,
+	          Properties::NON_VIRTUAL,
+	          __void__clear,
+	          "",
+	          "");
+	I_Method0(void, compileBuffer,
+	          Properties::NON_VIRTUAL,
+	          __void__compileBuffer,
+	          "",
+	          "");
+	I_Method0(void, deleteGLObject,
+	          Properties::NON_VIRTUAL,
+	          __void__deleteGLObject,
+	          "",
+	          "");
+	I_Method1(void, assign, IN, osg::BufferObject *, bufferObject,
+	          Properties::NON_VIRTUAL,
+	          __void__assign__BufferObject_P1,
+	          "",
+	          "");
+	I_Method0(bool, isPBOSupported,
+	          Properties::NON_VIRTUAL,
+	          __bool__isPBOSupported,
+	          "",
+	          "");
+	I_StaticMethod2(osg::GLBufferObject *, createGLBufferObject, IN, unsigned int, contextID, IN, const osg::BufferObject *, bufferObject,
+	                __GLBufferObject_P1__createGLBufferObject__unsigned_int__C5_BufferObject_P1_S,
+	                "",
+	                "");
 	I_StaticMethod2(void, deleteBufferObject, IN, unsigned int, contextID, IN, GLuint, globj,
 	                __void__deleteBufferObject__unsigned_int__GLuint_S,
@@ -124,118 +413,39 @@
 	                "dicard all the cached display list which need to be deleted in the OpenGL context related to contextID. ",
 	                "Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. ");
-	I_StaticMethod2(osg::BufferObject::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized,
+	I_StaticMethod2(osg::GLBufferObject::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized,
 	                __Extensions_P1__getExtensions__unsigned_int__bool_S,
 	                "Function to call to get the extension of a specified context. ",
 	                "If the Extension object for that context has not yet been created and the 'createIfNotInitalized' flag been set to false then returns NULL. If 'createIfNotInitalized' is true then the Extensions object is automatically created. However, in this case the extension object is only created with the graphics context associated with ContextID.. ");
-	I_StaticMethod2(void, setExtensions, IN, unsigned int, contextID, IN, osg::BufferObject::Extensions *, extensions,
+	I_StaticMethod2(void, setExtensions, IN, unsigned int, contextID, IN, osg::GLBufferObject::Extensions *, extensions,
 	                __void__setExtensions__unsigned_int__Extensions_P1_S,
 	                "setExtensions allows users to override the extensions across graphics contexts. ",
 	                "typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions. ");
-	I_SimpleProperty(GLenum, Usage, 
-	                 __GLenum__getUsage, 
-	                 __void__setUsage__GLenum);
-END_REFLECTOR
-
-BEGIN_VALUE_REFLECTOR(osg::BufferObject::BufferEntry)
+	I_SimpleProperty(osg::BufferObject *, BufferObject, 
+	                 __BufferObject_P1__getBufferObject, 
+	                 __void__setBufferObject__BufferObject_P1);
+	I_SimpleProperty(unsigned int, ContextID, 
+	                 __unsigned_int__getContextID, 
+	                 0);
+	I_SimpleProperty(GLuint, GLObjectID, 
+	                 __GLuint__getGLObjectID, 
+	                 0);
+	I_PublicMemberProperty(osg::GLBufferObject::Extensions *, _extensions);
+END_REFLECTOR
+
+BEGIN_VALUE_REFLECTOR(osg::GLBufferObject::BufferEntry)
 	I_DeclaringFile("osg/BufferObject");
 	I_Constructor0(____BufferEntry,
 	               "",
 	               "");
-	I_Constructor1(IN, const osg::BufferObject::BufferEntry &, be,
+	I_Constructor1(IN, const osg::GLBufferObject::BufferEntry &, rhs,
 	               Properties::NON_EXPLICIT,
 	               ____BufferEntry__C5_BufferEntry_R1,
 	               "",
 	               "");
-	I_PublicMemberProperty(osg::buffered_value< unsigned int >, modifiedCount);
-	I_PublicMemberProperty(unsigned int, dataSize);
-	I_PublicMemberProperty(unsigned int, offset);
-END_REFLECTOR
-
-TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA  osg::DrawElements * >, osg::ElementBufferObject::BufferEntryDrawElementsPair)
-
-TYPE_NAME_ALIAS(std::vector< osg::ElementBufferObject::BufferEntryDrawElementsPair >, osg::ElementBufferObject::BufferEntryDrawElementsPairs)
-
-BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
-	I_DeclaringFile("osg/BufferObject");
-	I_BaseType(osg::BufferObject);
-	I_Constructor0(____ElementBufferObject,
-	               "",
-	               "");
-	I_ConstructorWithDefaults2(IN, const osg::ElementBufferObject &, pbo, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
-	                           ____ElementBufferObject__C5_ElementBufferObject_R1__C5_CopyOp_R1,
-	                           "Copy constructor using CopyOp to manage deep vs shallow copy. ",
-	                           "");
-	I_Method0(osg::Object *, cloneType,
-	          Properties::VIRTUAL,
-	          __osg_Object_P1__cloneType,
-	          "Clone the type of an object, with Object* return type. ",
-	          "Must be defined by derived classes. ");
-	I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x,
-	          Properties::VIRTUAL,
-	          __osg_Object_P1__clone__C5_osg_CopyOp_R1,
-	          "Clone an object, with Object* return type. ",
-	          "Must be defined by derived classes. ");
-	I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
-	          Properties::VIRTUAL,
-	          __bool__isSameKindAs__C5_osg_Object_P1,
-	          "",
-	          "");
-	I_Method0(const char *, libraryName,
-	          Properties::VIRTUAL,
-	          __C5_char_P1__libraryName,
-	          "return the name of the object's library. ",
-	          "Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
-	I_Method0(const char *, className,
-	          Properties::VIRTUAL,
-	          __C5_char_P1__className,
-	          "return the name of the object's class type. ",
-	          "Must be defined by derived classes. ");
-	I_Method1(unsigned int, addDrawElements, IN, osg::DrawElements *, PrimitiveSet,
-	          Properties::NON_VIRTUAL,
-	          __unsigned_int__addDrawElements__osg_DrawElements_P1,
-	          "",
-	          "");
-	I_Method1(void, removeDrawElements, IN, osg::DrawElements *, PrimitiveSet,
-	          Properties::NON_VIRTUAL,
-	          __void__removeDrawElements__osg_DrawElements_P1,
-	          "",
-	          "");
-	I_Method2(void, setDrawElements, IN, unsigned int, i, IN, osg::DrawElements *, PrimitiveSet,
-	          Properties::NON_VIRTUAL,
-	          __void__setDrawElements__unsigned_int__DrawElements_P1,
-	          "",
-	          "");
-	I_Method1(osg::DrawElements *, getDrawElements, IN, unsigned int, i,
-	          Properties::NON_VIRTUAL,
-	          __DrawElements_P1__getDrawElements__unsigned_int,
-	          "",
-	          "");
-	I_Method1(const osg::DrawElements *, getDrawElements, IN, unsigned int, i,
-	          Properties::NON_VIRTUAL,
-	          __C5_DrawElements_P1__getDrawElements__unsigned_int,
-	          "",
-	          "");
-	I_Method1(const GLvoid *, getOffset, IN, unsigned int, i,
-	          Properties::NON_VIRTUAL,
-	          __C5_GLvoid_P1__getOffset__unsigned_int,
-	          "",
-	          "");
-	I_Method1(void, compileBuffer, IN, osg::State &, state,
-	          Properties::VIRTUAL,
-	          __void__compileBuffer__State_R1,
-	          "",
-	          "");
-	I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
-	          Properties::VIRTUAL,
-	          __void__resizeGLObjectBuffers__unsigned_int,
-	          "Resize any per context GLObject buffers to specified size. ",
-	          "");
-	I_IndexedProperty(osg::DrawElements *, DrawElements, 
-	                  __DrawElements_P1__getDrawElements__unsigned_int, 
-	                  __void__setDrawElements__unsigned_int__DrawElements_P1, 
-	                  0);
-END_REFLECTOR
-
-TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA  osg::Image * >, osg::PixelBufferObject::BufferEntryImagePair)
+	I_PublicMemberProperty(unsigned int, modifiedCount);
+	I_PublicMemberProperty(GLsizeiptrARB, dataSize);
+	I_PublicMemberProperty(GLsizeiptrARB, offset);
+	I_PublicMemberProperty(osg::BufferData *, dataSource);
+END_REFLECTOR
 
 BEGIN_OBJECT_REFLECTOR(osg::PixelBufferObject)
@@ -291,18 +501,8 @@
 	          "",
 	          "");
-	I_Method0(unsigned int, offset,
-	          Properties::NON_VIRTUAL,
-	          __unsigned_int__offset,
-	          "",
-	          "");
-	I_Method1(void, compileBuffer, IN, osg::State &, state,
-	          Properties::VIRTUAL,
-	          __void__compileBuffer__State_R1,
-	          "",
-	          "");
-	I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
-	          Properties::VIRTUAL,
-	          __void__resizeGLObjectBuffers__unsigned_int,
-	          "Resize any per context GLObject buffers to specified size. ",
+	I_Method1(bool, isPBOSupported, IN, unsigned int, contextID,
+	          Properties::NON_VIRTUAL,
+	          __bool__isPBOSupported__unsigned_int,
+	          "",
 	          "");
 	I_SimpleProperty(osg::Image *, Image, 
@@ -398,8 +598,4 @@
 END_REFLECTOR
 
-TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA  osg::Array * >, osg::VertexBufferObject::BufferEntryArrayPair)
-
-TYPE_NAME_ALIAS(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >, osg::VertexBufferObject::BufferEntryArrayPairs)
-
 BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
 	I_DeclaringFile("osg/BufferObject");
@@ -462,19 +658,4 @@
 	          "",
 	          "");
-	I_Method1(const GLvoid *, getOffset, IN, unsigned int, i,
-	          Properties::NON_VIRTUAL,
-	          __C5_GLvoid_P1__getOffset__unsigned_int,
-	          "",
-	          "");
-	I_Method1(void, compileBuffer, IN, osg::State &, state,
-	          Properties::VIRTUAL,
-	          __void__compileBuffer__State_R1,
-	          "",
-	          "");
-	I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
-	          Properties::VIRTUAL,
-	          __void__resizeGLObjectBuffers__unsigned_int,
-	          "Resize any per context GLObject buffers to specified size. ",
-	          "");
 	I_IndexedProperty(osg::Array *, Array, 
 	                  __Array_P1__getArray__unsigned_int, 
@@ -483,12 +664,2 @@
 END_REFLECTOR
 
-STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA  osg::Array * >)
-
-STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA  osg::DrawElements * >)
-
-STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA  osg::Image * >)
-
-STD_VECTOR_REFLECTOR(std::vector< osg::ElementBufferObject::BufferEntryDrawElementsPair >)
-
-STD_VECTOR_REFLECTOR(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >)
-
Index: /OpenSceneGraph/trunk/src/osgWrappers/osg/PrimitiveSet.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/osg/PrimitiveSet.cpp (revision 9969)
+++ /OpenSceneGraph/trunk/src/osgWrappers/osg/PrimitiveSet.cpp (revision 10600)
@@ -158,9 +158,4 @@
 	          "",
 	          "");
-	I_Method0(void, dirty,
-	          Properties::VIRTUAL,
-	          __void__dirty,
-	          "Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
-	          "");
 	I_Method1(void, setElementBufferObject, IN, osg::ElementBufferObject *, ebo,
 	          Properties::NON_VIRTUAL,
@@ -178,24 +173,4 @@
 	          "Get the const ElementBufferObject. ",
 	          "If no EBO is assigned returns NULL ");
-	I_Method1(void, setElementBufferObjectOffset, IN, const GLvoid *, offset,
-	          Properties::NON_VIRTUAL,
-	          __void__setElementBufferObjectOffset__C5_GLvoid_P1,
-	          "Set the offset into the ElementBufferObject, if used. ",
-	          "");
-	I_Method0(const GLvoid *, getElementBufferObjectOffset,
-	          Properties::NON_VIRTUAL,
-	          __C5_GLvoid_P1__getElementBufferObjectOffset,
-	          "Get the offset into the ElementBufferOffset, if used. ",
-	          "");
-	I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
-	          Properties::VIRTUAL,
-	          __void__resizeGLObjectBuffers__unsigned_int,
-	          "Resize any per context GLObject buffers to specified size. ",
-	          "");
-	I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
-	                      Properties::VIRTUAL,
-	                      __void__releaseGLObjects__State_P1,
-	                      "If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
-	                      "Otherwise, releases OpenGL objects for all graphics contexts. ");
 	I_Method1(void, reserveElements, IN, unsigned int, numIndices,
 	          Properties::PURE_VIRTUAL,
@@ -224,7 +199,4 @@
 	                 __osg_ElementBufferObject_P1__getElementBufferObject, 
 	                 __void__setElementBufferObject__osg_ElementBufferObject_P1);
-	I_SimpleProperty(const GLvoid *, ElementBufferObjectOffset, 
-	                 __C5_GLvoid_P1__getElementBufferObjectOffset, 
-	                 __void__setElementBufferObjectOffset__C5_GLvoid_P1);
 END_REFLECTOR
 
@@ -430,5 +402,5 @@
 BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet)
 	I_DeclaringFile("osg/PrimitiveSet");
-	I_BaseType(osg::Object);
+	I_BaseType(osg::BufferData);
 	I_ConstructorWithDefaults3(IN, osg::PrimitiveSet::Type, primType, osg::PrimitiveSet::PrimitiveType, IN, GLenum, mode, 0, IN, int, numInstances, 0,
 	                           ____PrimitiveSet__Type__GLenum__int,
@@ -539,29 +511,4 @@
 	          "",
 	          "");
-	I_Method0(void, dirty,
-	          Properties::VIRTUAL,
-	          __void__dirty,
-	          "Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
-	          "");
-	I_Method1(void, setModifiedCount, IN, unsigned int, value,
-	          Properties::NON_VIRTUAL,
-	          __void__setModifiedCount__unsigned_int,
-	          "Set the modified count value. ",
-	          "");
-	I_Method0(unsigned int, getModifiedCount,
-	          Properties::NON_VIRTUAL,
-	          __unsigned_int__getModifiedCount,
-	          "Get modified count value. ",
-	          "");
-	I_Method1(void, resizeGLObjectBuffers, IN, unsigned, int,
-	          Properties::VIRTUAL,
-	          __void__resizeGLObjectBuffers__unsigned,
-	          "Resize any per context GLObject buffers to specified size. ",
-	          "");
-	I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, x, 0,
-	                      Properties::VIRTUAL,
-	                      __void__releaseGLObjects__State_P1,
-	                      "If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
-	                      "Otherwise, releases OpenGL objects for all graphics contexts. ");
 	I_Method0(void, computeRange,
 	          Properties::VIRTUAL,
@@ -578,7 +525,4 @@
 	                 __GLenum__getMode, 
 	                 __void__setMode__GLenum);
-	I_SimpleProperty(unsigned int, ModifiedCount, 
-	                 __unsigned_int__getModifiedCount, 
-	                 __void__setModifiedCount__unsigned_int);
 	I_SimpleProperty(int, NumInstances, 
 	                 0, 
Index: /OpenSceneGraph/trunk/src/osgWrappers/osg/Image.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/osg/Image.cpp (revision 9918)
+++ /OpenSceneGraph/trunk/src/osgWrappers/osg/Image.cpp (revision 10600)
@@ -53,5 +53,5 @@
 BEGIN_OBJECT_REFLECTOR(osg::Image)
 	I_DeclaringFile("osg/Image");
-	I_BaseType(osg::Object);
+	I_BaseType(osg::BufferData);
 	I_Constructor0(____Image,
 	               "",
@@ -86,4 +86,14 @@
 	          "return the name of the object's class type. ",
 	          "Must be defined by derived classes. ");
+	I_Method0(const GLvoid *, getDataPointer,
+	          Properties::VIRTUAL,
+	          __C5_GLvoid_P1__getDataPointer,
+	          "",
+	          "");
+	I_Method0(unsigned int, getTotalDataSize,
+	          Properties::VIRTUAL,
+	          __unsigned_int__getTotalDataSize,
+	          "",
+	          "");
 	I_Method1(int, compare, IN, const osg::Image &, rhs,
 	          Properties::VIRTUAL,
@@ -311,19 +321,4 @@
 	          "Ensure image dimensions are a power of two. ",
 	          "Mipmapped textures require the image dimensions to be power of two and are within the maxiumum texture size for the host machine. ");
-	I_Method0(void, dirty,
-	          Properties::NON_VIRTUAL,
-	          __void__dirty,
-	          "Dirty the image, which increments the modified count, to force osg::Texture to reload the image. ",
-	          "");
-	I_Method1(void, setModifiedCount, IN, unsigned int, value,
-	          Properties::NON_VIRTUAL,
-	          __void__setModifiedCount__unsigned_int,
-	          "Set the modified count value. ",
-	          "Used by osg::Texture when using texture subloading. ");
-	I_Method0(unsigned int, getModifiedCount,
-	          Properties::NON_VIRTUAL,
-	          __unsigned_int__getModifiedCount,
-	          "Get modified count value. ",
-	          "Used by osg::Texture when using texture subloading. ");
 	I_Method0(bool, isMipmap,
 	          Properties::NON_VIRTUAL,
@@ -448,4 +443,7 @@
 	                 __AllocationMode__getAllocationMode, 
 	                 __void__setAllocationMode__AllocationMode);
+	I_SimpleProperty(const GLvoid *, DataPointer, 
+	                 __C5_GLvoid_P1__getDataPointer, 
+	                 0);
 	I_SimpleProperty(GLenum, DataType, 
 	                 __GLenum__getDataType, 
@@ -466,7 +464,4 @@
 	                 __C5_MipmapDataType_R1__getMipmapLevels, 
 	                 __void__setMipmapLevels__C5_MipmapDataType_R1);
-	I_SimpleProperty(unsigned int, ModifiedCount, 
-	                 __unsigned_int__getModifiedCount, 
-	                 __void__setModifiedCount__unsigned_int);
 	I_SimpleProperty(osg::Image::Origin, Origin, 
 	                 __Origin__getOrigin, 
@@ -490,4 +485,7 @@
 	                 __unsigned_int__getRowSizeInBytes, 
 	                 0);
+	I_SimpleProperty(unsigned int, TotalDataSize, 
+	                 __unsigned_int__getTotalDataSize, 
+	                 0);
 	I_SimpleProperty(unsigned int, TotalSizeInBytes, 
 	                 __unsigned_int__getTotalSizeInBytes, 
Index: /OpenSceneGraph/trunk/src/osgWrappers/osg/State.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/osg/State.cpp (revision 10588)
+++ /OpenSceneGraph/trunk/src/osgWrappers/osg/State.cpp (revision 10600)
@@ -332,17 +332,17 @@
 	          "dirty the vertex, normal, color, tex coords, secondary color, fog coord and index arrays. ",
 	          "");
-	I_Method1(void, setCurrentVertexBufferObject, IN, osg::VertexBufferObject *, vbo,
-	          Properties::NON_VIRTUAL,
-	          __void__setCurrentVertexBufferObject__osg_VertexBufferObject_P1,
-	          "",
-	          "");
-	I_Method0(const osg::VertexBufferObject *, getCurrentVertexBufferObject,
-	          Properties::NON_VIRTUAL,
-	          __C5_VertexBufferObject_P1__getCurrentVertexBufferObject,
-	          "",
-	          "");
-	I_Method1(void, bindVertexBufferObject, IN, const osg::VertexBufferObject *, vbo,
-	          Properties::NON_VIRTUAL,
-	          __void__bindVertexBufferObject__C5_osg_VertexBufferObject_P1,
+	I_Method1(void, setCurrentVertexBufferObject, IN, osg::GLBufferObject *, vbo,
+	          Properties::NON_VIRTUAL,
+	          __void__setCurrentVertexBufferObject__osg_GLBufferObject_P1,
+	          "",
+	          "");
+	I_Method0(const osg::GLBufferObject *, getCurrentVertexBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __C5_GLBufferObject_P1__getCurrentVertexBufferObject,
+	          "",
+	          "");
+	I_Method1(void, bindVertexBufferObject, IN, osg::GLBufferObject *, vbo,
+	          Properties::NON_VIRTUAL,
+	          __void__bindVertexBufferObject__osg_GLBufferObject_P1,
 	          "",
 	          "");
@@ -352,17 +352,17 @@
 	          "",
 	          "");
-	I_Method1(void, setCurrentElementBufferObject, IN, osg::ElementBufferObject *, ebo,
-	          Properties::NON_VIRTUAL,
-	          __void__setCurrentElementBufferObject__osg_ElementBufferObject_P1,
-	          "",
-	          "");
-	I_Method0(const osg::ElementBufferObject *, getCurrentElementBufferObject,
-	          Properties::NON_VIRTUAL,
-	          __C5_ElementBufferObject_P1__getCurrentElementBufferObject,
-	          "",
-	          "");
-	I_Method1(void, bindElementBufferObject, IN, const osg::ElementBufferObject *, ebo,
-	          Properties::NON_VIRTUAL,
-	          __void__bindElementBufferObject__C5_osg_ElementBufferObject_P1,
+	I_Method1(void, setCurrentElementBufferObject, IN, osg::GLBufferObject *, ebo,
+	          Properties::NON_VIRTUAL,
+	          __void__setCurrentElementBufferObject__osg_GLBufferObject_P1,
+	          "",
+	          "");
+	I_Method0(const osg::GLBufferObject *, getCurrentElementBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __C5_GLBufferObject_P1__getCurrentElementBufferObject,
+	          "",
+	          "");
+	I_Method1(void, bindElementBufferObject, IN, osg::GLBufferObject *, ebo,
+	          Properties::NON_VIRTUAL,
+	          __void__bindElementBufferObject__osg_GLBufferObject_P1,
 	          "",
 	          "");
@@ -372,17 +372,17 @@
 	          "",
 	          "");
-	I_Method1(void, setCurrentPixelBufferObject, IN, osg::PixelBufferObject *, pbo,
-	          Properties::NON_VIRTUAL,
-	          __void__setCurrentPixelBufferObject__osg_PixelBufferObject_P1,
-	          "",
-	          "");
-	I_Method0(const osg::PixelBufferObject *, getCurrentPixelBufferObject,
-	          Properties::NON_VIRTUAL,
-	          __C5_PixelBufferObject_P1__getCurrentPixelBufferObject,
-	          "",
-	          "");
-	I_Method1(void, bindPixelBufferObject, IN, const osg::PixelBufferObject *, pbo,
-	          Properties::NON_VIRTUAL,
-	          __void__bindPixelBufferObject__C5_osg_PixelBufferObject_P1,
+	I_Method1(void, setCurrentPixelBufferObject, IN, osg::GLBufferObject *, pbo,
+	          Properties::NON_VIRTUAL,
+	          __void__setCurrentPixelBufferObject__osg_GLBufferObject_P1,
+	          "",
+	          "");
+	I_Method0(const osg::GLBufferObject *, getCurrentPixelBufferObject,
+	          Properties::NON_VIRTUAL,
+	          __C5_GLBufferObject_P1__getCurrentPixelBufferObject,
+	          "",
+	          "");
+	I_Method1(void, bindPixelBufferObject, IN, osg::GLBufferObject *, pbo,
+	          Properties::NON_VIRTUAL,
+	          __void__bindPixelBufferObject__osg_GLBufferObject_P1,
 	          "",
 	          "");
@@ -831,13 +831,13 @@
 	                 __unsigned_int__getContextID, 
 	                 __void__setContextID__unsigned_int);
-	I_SimpleProperty(osg::ElementBufferObject *, CurrentElementBufferObject, 
-	                 0, 
-	                 __void__setCurrentElementBufferObject__osg_ElementBufferObject_P1);
-	I_SimpleProperty(osg::PixelBufferObject *, CurrentPixelBufferObject, 
-	                 0, 
-	                 __void__setCurrentPixelBufferObject__osg_PixelBufferObject_P1);
-	I_SimpleProperty(osg::VertexBufferObject *, CurrentVertexBufferObject, 
-	                 0, 
-	                 __void__setCurrentVertexBufferObject__osg_VertexBufferObject_P1);
+	I_SimpleProperty(osg::GLBufferObject *, CurrentElementBufferObject, 
+	                 0, 
+	                 __void__setCurrentElementBufferObject__osg_GLBufferObject_P1);
+	I_SimpleProperty(osg::GLBufferObject *, CurrentPixelBufferObject, 
+	                 0, 
+	                 __void__setCurrentPixelBufferObject__osg_GLBufferObject_P1);
+	I_SimpleProperty(osg::GLBufferObject *, CurrentVertexBufferObject, 
+	                 0, 
+	                 __void__setCurrentVertexBufferObject__osg_GLBufferObject_P1);
 	I_SimpleProperty(const osg::Viewport *, CurrentViewport, 
 	                 __C5_Viewport_P1__getCurrentViewport, 
Index: /OpenSceneGraph/trunk/src/osgWrappers/osg/Array.cpp
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/osg/Array.cpp (revision 8468)
+++ /OpenSceneGraph/trunk/src/osgWrappers/osg/Array.cpp (revision 10600)
@@ -65,5 +65,5 @@
 BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
 	I_DeclaringFile("osg/Array");
-	I_BaseType(osg::Object);
+	I_BaseType(osg::BufferData);
 	I_ConstructorWithDefaults3(IN, osg::Array::Type, arrayType, osg::Array::ArrayType, IN, GLint, dataSize, 0, IN, GLenum, dataType, 0,
 	                           ____Array__Type__GLint__GLenum,
@@ -149,19 +149,4 @@
 	          "Frees unused space on this vector - i.e. ",
 	          "the difference between size() and max_size() of the underlying vector. ");
-	I_Method0(void, dirty,
-	          Properties::NON_VIRTUAL,
-	          __void__dirty,
-	          "Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
-	          "");
-	I_Method1(void, setModifiedCount, IN, unsigned int, value,
-	          Properties::NON_VIRTUAL,
-	          __void__setModifiedCount__unsigned_int,
-	          "Set the modified count value. ",
-	          "");
-	I_Method0(unsigned int, getModifiedCount,
-	          Properties::NON_VIRTUAL,
-	          __unsigned_int__getModifiedCount,
-	          "Get modified count value. ",
-	          "");
 	I_Method1(void, setVertexBufferObject, IN, osg::VertexBufferObject *, vbo,
 	          Properties::NON_VIRTUAL,
@@ -179,14 +164,4 @@
 	          "Get the const VertexBufferObject. ",
 	          "If no VBO is assigned returns NULL ");
-	I_Method1(void, setVertexBufferObjectOffset, IN, const GLvoid *, offset,
-	          Properties::NON_VIRTUAL,
-	          __void__setVertexBufferObjectOffset__C5_GLvoid_P1,
-	          "Set the offset into the VertexBufferObject, if used. ",
-	          "");
-	I_Method0(const GLvoid *, getVertexBufferObjectOffset,
-	          Properties::NON_VIRTUAL,
-	          __C5_GLvoid_P1__getVertexBufferObjectOffset,
-	          "Get the offset into the VertexBufferObject, if used. ",
-	          "");
 	I_SimpleProperty(const GLvoid *, DataPointer, 
 	                 __C5_GLvoid_P1__getDataPointer, 
@@ -198,7 +173,4 @@
 	                 __GLenum__getDataType, 
 	                 0);
-	I_SimpleProperty(unsigned int, ModifiedCount, 
-	                 __unsigned_int__getModifiedCount, 
-	                 __void__setModifiedCount__unsigned_int);
 	I_SimpleProperty(unsigned int, TotalDataSize, 
 	                 __unsigned_int__getTotalDataSize, 
@@ -210,7 +182,4 @@
 	                 __osg_VertexBufferObject_P1__getVertexBufferObject, 
 	                 __void__setVertexBufferObject__osg_VertexBufferObject_P1);
-	I_SimpleProperty(const GLvoid *, VertexBufferObjectOffset, 
-	                 __C5_GLvoid_P1__getVertexBufferObjectOffset, 
-	                 __void__setVertexBufferObjectOffset__C5_GLvoid_P1);
 END_REFLECTOR
 
Index: /OpenSceneGraph/trunk/src/osgWrappers/genwrapper.conf
===================================================================
--- /OpenSceneGraph/trunk/src/osgWrappers/genwrapper.conf (revision 10554)
+++ /OpenSceneGraph/trunk/src/osgWrappers/genwrapper.conf (revision 10600)
@@ -446,5 +446,5 @@
 suppress reflector "osg::GL2Extensions"
 suppress reflector "osg::Drawable::Extensions"
-suppress reflector "osg::BufferObject::Extensions"
+suppress reflector "osg::GLBufferObject::Extensions"
 suppress reflector "osg::FBOExtensions"
 suppress reflector "osg::Drawable::Extensions"
Index: /OpenSceneGraph/trunk/examples/osgparametric/osgparametric.cpp
===================================================================
--- /OpenSceneGraph/trunk/examples/osgparametric/osgparametric.cpp (revision 6941)
+++ /OpenSceneGraph/trunk/examples/osgparametric/osgparametric.cpp (revision 10600)
@@ -107,5 +107,5 @@
 };
 
-osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool vbo)
+osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool useVBO)
 {
     osg::Geode* geode = new osg::Geode;
@@ -239,8 +239,8 @@
     geom->setVertexArray(vertices);
 
-    osg::VertexBufferObject* vbObject = new osg::VertexBufferObject;
-    vertices->setVertexBufferObject(vbObject);
-    
-    osg::ElementBufferObject* ebo = new osg::ElementBufferObject;
+    osg::VertexBufferObject* vbo = useVBO ? new osg::VertexBufferObject : 0;
+    if (vbo) vertices->setVertexBufferObject(vbo);
+    
+    osg::ElementBufferObject* ebo = useVBO ? new osg::ElementBufferObject : 0;
 
     for(iy=0; iy<num_y-1; ++iy)
@@ -256,5 +256,5 @@
         geom->addPrimitiveSet(elements); 
         
-        if (ebo) elements->setElementBufferObject(ebo);   
+        if (ebo) elements->setElementBufferObject(ebo);
     }
     
Index: /OpenSceneGraph/trunk/examples/osgscreencapture/osgscreencapture.cpp
===================================================================
--- /OpenSceneGraph/trunk/examples/osgscreencapture/osgscreencapture.cpp (revision 10064)
+++ /OpenSceneGraph/trunk/examples/osgscreencapture/osgscreencapture.cpp (revision 10600)
@@ -138,5 +138,5 @@
             void read()
             {
-                osg::BufferObject::Extensions* ext = osg::BufferObject::getExtensions(_gc->getState()->getContextID(),true);
+                osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions(_gc->getState()->getContextID(),true);
 
                 if (ext->isPBOSupported() && !_pboBuffer.empty())
@@ -159,7 +159,7 @@
             void readPixels();
 
-            void singlePBO(osg::BufferObject::Extensions* ext);
-
-            void multiPBO(osg::BufferObject::Extensions* ext);
+            void singlePBO(osg::GLBufferObject::Extensions* ext);
+
+            void multiPBO(osg::GLBufferObject::Extensions* ext);
         
             typedef std::vector< osg::ref_ptr<osg::Image> >             ImageBuffer;
@@ -326,5 +326,5 @@
 }
 
-void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions* ext)
+void WindowCaptureCallback::ContextData::singlePBO(osg::GLBufferObject::Extensions* ext)
 {
     // std::cout<<"singelPBO(  "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
@@ -403,5 +403,5 @@
 }
 
-void WindowCaptureCallback::ContextData::multiPBO(osg::BufferObject::Extensions* ext)
+void WindowCaptureCallback::ContextData::multiPBO(osg::GLBufferObject::Extensions* ext)
 {
     // std::cout<<"multiPBO(  "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
